You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
os.Root supports a few more platforms than safeopen. (Notably GOOS=wasip1, probably less notably GOOS=plan9.)
os.Root doesn't use openat2/RESOLVE_BENEATH yet (hopefully it will in Go 1.25) and will be less efficient than safeopen when openat2 is available.
os.Root tries quite hard to preserve platform path semantics: For example, on Unix a/../b follows (non-escaping) symlinks in a. I believe safeopen rejects paths containing .. components. (From a quick look, safeopen also rejects symlinks entirely on systems that don't have openat2/RESOLVE_BENEATH?)
Go 1.24 introduces the
os.Root
family of file APIs: https://go.dev/blog/osroot (cc @neild). These APIs are resistant to path traversal.If I'm understanding things correctly, this is a replacement for safeopen. It may be a good idea to:
os.Root
instead of safeopen.os.Root
.The text was updated successfully, but these errors were encountered: