-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
os: OpenRoot follows symlinks #71806
Comments
@neild if this is supposed to be allowed, perhaps clarify the docs? "Symbolic links must not be absolute." <- I was not sure if/how that was supposed to apply to pre-existing absolute symlinks. I'd like to be able to chroot a directory with absolute symlinks already in it (since I have a ton of these), but just not have them followed if opened. |
The parts you quote are only for methods, after you've opened a root. Conceptually, the only safe way is to start from a trusted location, in your case os.OpenRoot("."), after which you can't follow links out. |
Change https://go.dev/cl/650355 mentions this issue: |
As @seankhliao says, the name passed to
If an operation in a |
Go version
go version 1.24.0
Output of
go env
in your module/workspace:What did you do?
Reading #67002 and https://go.dev/doc/go1.24#directory-limited-filesystem-access, I was under the impression that the new os.Root was supposed to return an error on root.Open() of a symlink to /etc/ and then opening /etc/passwd.
On MacOS Sonoma 14.0, go 1.24.0 amd64:
What did you see happen?
See above.
What did you expect to see?
Not to be able to access /etc/password from an os.Root in /Users/jaten/trash/root.
The text was updated successfully, but these errors were encountered: