WebAssembly / WebAssembly/WASI

Clarifying path normalization, or lack thereof

Open
#769 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P-filesystem S-inactive
Dominant language
Rust
Stars
5.8k
Forks
333
Avg merge
2d 13h
Merged PRs (30d)
3

Description

Any WASI runtime acting as any sort of sandbox should restrict access to unmapped paths. However, through path normalization, a path might end up "within" the sandbox. The question is, should WASI implementations be expected to implement such normalization, or is it safe to assume callers should normalize their own paths if they want that behavior?

That is, given:

let root : Fd = 4; // ...preopened directory fd...

Which of these, if any, should reasonably be expected to succeed? And in the case of symlinks, should ".." navigate to the parent based on the path before the symlinks resolve, or after?

let root2 : Fd = path_open(root,  ..., ".",  ...).unwrap();
let root2 : Fd = path_open(root,  ..., "existing/..",  ...).unwrap();
let root2 : Fd = path_open(root,  ..., "symlink/..",  ...).unwrap();
let root2 : Fd = path_open(root,  ..., "nonexistant/..",  ...).unwrap();
let dir   : Fd = path_open(root, ..., "existing", ...).unwrap();
let root2 : Fd = path_open(dir,  ..., "..",  ...).unwrap();
let dir   : Fd = path_open(root, ..., "symlink", ...).unwrap();
let root2 : Fd = path_open(dir,  ..., "..",  ...).unwrap();

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the WASI path_open semantics and the sandboxing expectations described in the issue. Compare the listed cases involving '.', '..', symlinks, and nonexistent paths, then establish and document consistent normalization and resolution rules for each case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, operating-systems, security
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.