bytecodealliance / bytecodealliance/cap-std
Ability to construct virtual `Dir`s to mount files and subdirectories into
- Dominant language
- Rust
- Stars
- 821
- Forks
- 57
- Avg merge
- 1h 16m
- Merged PRs (30d)
- 4
Description
Specifically with the option for those files/dirs to just be paths that don’t need to be opened when mounted. Note: When I say “mount” here this would only be internal to the `Dir` struct and not actual mounts on the underling filesystem. Similar to `Pool`’s `insert` methods.
Would particularly be interesting to create a root `Dir` which would just be `/` on Unix but on Windows a folder exposing all drive letters as subfolders. I understand that this specific use case may be controversial, as it seems to go against the spirit of this crate. But I believe the opposite to be true: The great thing about this API is that it doesn’t just have one or two layers (as more basic security systems), but arbitrarily many as each `Dir` recursively can be used to create narrower views. So I don’t think one global directory as the base to craft more specialised capabilities would inherently be a bad idea.
Based originally on thinking in https://github.com/bytecodealliance/wasmtime/issues/8552 to solve the problem of Windows (unlike Unix) not having a single root folder but essentially one for each volume, which makes `cap-std` difficult to use in some contexts.
I apologise should what I propose already be possible, in a quick look into the docs I haven’t figured out a way to do this.
Contributor guide
Research direction
Start by reading the existing Dir construction APIs and Pool's insert methods, then compare how paths are opened and represented. Determine whether virtual files and subdirectories can be mounted without opening them while preserving recursive capability restrictions. Done should include a settled cross-platform design, including the proposed Windows drive-root use case, with documented behavior and tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100