fix(permissions): close write-path TOCTOU and warn on overbroad roots - #433
Open
HaoChiBao wants to merge 2 commits into
Open
fix(permissions): close write-path TOCTOU and warn on overbroad roots#433HaoChiBao wants to merge 2 commits into
HaoChiBao wants to merge 2 commits into
Conversation
Re-validate writable-root scoping immediately before writes execute, and surface a warning when a granted root resolves to $HOME or above.
Drop patch-path parsing and trim overbroad-root warning/tests to the TOCTOU recheck and $HOME-breadth warn.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #35: two edge cases in file-write path scoping.
Files changed
coworker/permissions.pyrevalidate_write()— same writable-root check as evaluate, meant to run again right before the write.coworker/engine.py_execute_syncimmediately before the tool runs (after approval / auto-allow).coworker/roots.pyoverbroad_root_warning()to detect grants that resolve to$HOMEor above.coworker/server/manager.pyadd_root: still grants access, but logs and returns awarning.tests/test_path_scoping.pyTest plan
pytest tests/test_path_scoping.py tests/test_tools_permissions.py tests/test_multiroot.py$HOME(or a symlink to it) still grants access and includes a warningCloses #35