tools/builtin: path jail is a construction value, not a global #1921

Closed
opened 2026-11-12 16:35:16 +00:00 by sam · 1 comment
Owner

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.

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.
sam added the bughigh labels 2026-11-12 16:35:16 +00:00
Author
Owner

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.

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.
sam closed this issue 2026-11-12 16:57:18 +00:00
sam added a new dependency 2026-11-13 02:50:40 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#1921