tools/builtin: path jail is a construction value, not a global #1921
Notifications
Due Date
No due date set.
Blocks
#1920 Effective Go: critical paths
sam/archie
Reference: sam/archie#1921
Reference in new issue
Block a user
pathConfinement is a process-global atomic.Bool set by SetPathConfinement; the last provider to start decides the jail for every file tool in the process. Replace it with a Jail{Root, Unrestricted} value passed to each file tool, RegisterBuiltins, ResolveReadable and sendfile. Same change: edit.go matches its own "old_text not found" text; use a sentinel.
Done when no package-level confinement state remains and a test shows a confined jail still refuses ../ after an unrestricted one exists in the same process.
Done in
65e6bafb: the file tools, sendfile and RegisterBuiltins take a Jail value; the process-global switch and SetPathConfinement are gone. The edit tool's not-found check is a sentinel. No new test: a per-tool-set value makes the shared-switch bug unrepresentable. task check passed.