-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is unsafe
the best way to indicate ambient authority?
#141
Comments
Another option suggested here: introduce an |
For filesystem access specifically it can be argued that cap-std strives to bring OS interaction into scope of Rust's memory safety rules and can really handle the It should not be used just to warn about possible security logic violation that cannot be "upgraded" to memory safety errors, but I expect that many subsystems can ultimately lead to OS-assisted memory unsafety. For example, unrestricted starting of child processes can lead to a debugger debugging the parent process. |
I've started to experiment with the type idea, and have created a crate named A next step here might be to rewrite the |
Use the newly-created ambient-authority crate to indicate functions which have ambient authority, rather than using `unsafe`. Fixes #141.
Use the newly-created ambient-authority crate to indicate functions which have ambient authority, rather than using `unsafe`. Fixes #141.
Use the newly-created ambient-authority crate to indicate functions which have ambient authority, rather than using `unsafe`. Fixes #141.
Use the newly-created ambient-authority crate to indicate functions which have ambient authority, rather than using `unsafe`. Fixes #141.
Use the newly-created ambient-authority crate to indicate functions which have ambient authority, rather than using `unsafe`. Fixes #141.
Use the newly-created ambient-authority crate to indicate functions which have ambient authority, rather than using `unsafe`. Fixes #141.
Use the newly-created ambient-authority crate to indicate functions which have ambient authority, rather than using `unsafe`. Fixes #141.
#166 is now a PR which implements this. Along with a few other cleanups, it removes the last of the |
Use the newly-created ambient-authority crate to indicate functions which have ambient authority, rather than using `unsafe`. Fixes #141.
Use the newly-created ambient-authority crate to indicate functions which have ambient authority, rather than using `unsafe`. Fixes #141.
Ok, let's do it! Even if there could theoretically be a concept of "filesystem path safety", it wouldn't work the same way as memory safety or I/O safety, because concepts like ownership and lifetime don't work for filesystem namespaces the way they do for memory address spaces or handle index spaces. So I've convinced myself that even at a theoretical level, there's a natural boundary around |
Use the newly-created ambient-authority crate to indicate functions which have ambient authority, rather than using `unsafe`. Fixes #141.
cap-std crates currently use
unsafe
to indicate function which utilize ambient authorities, for exampleDir::open_ambient_dir
. As discussed here, this follows the precedent of Rust's standard library in makingFile::from_raw_fd
be unsafe.However, when porting code to cap-std, such as this Web server example and looking at it from the perspective of a user of the API incrementally adopting it, the use of
unsafe
has felt somewhat uncomfortable. So, what's the best approach here?Some possible options include:
unsafe
functions in a separate module, or even a separate crate.unsafe
.The text was updated successfully, but these errors were encountered: