Repository navigation
docs(governance): correct the security model around readonly rewrites - #383
Merged
Merged
Conversation
The comments added in #381 claimed the git branch misclassification was never exploitable because GitTool is SideEffectClass::Write and authorize still gates it. That is wrong, and it is wrong in the direction that matters. Approval is gated on tool identity, not side-effect class. hitl_tools holds the shell-equivalent tools (bash, background_run, exec_command, mcp:*) and apply_mode clears hitl_classes in every shipped mode, so authorize returns Allow for any tool outside that set before pattern rules are consulted. git is outside it, and GitTool's own argument policy permits -u/--set-upstream-to. Nothing downstream catches a misclassification. So readonly.rs is the boundary, not a layer above one, and #381 closed an approval bypass rather than fixing a cosmetic label: a mutating git command classified as a read became an unprompted mutation. Corrects the module header, the branch_is_readonly doc and the test comment, and pins the mechanism with two tests so it cannot be misread again: bash prompts while the rewritten git call is allowed outright, and both shipped modes leave hitl_classes empty.
mohitranka
added a commit
that referenced
this pull request
Aug 21, 2026
…#383) The comments added in #381 claimed the git branch misclassification was never exploitable because GitTool is SideEffectClass::Write and authorize still gates it. That is wrong, and it is wrong in the direction that matters. Approval is gated on tool identity, not side-effect class. hitl_tools holds the shell-equivalent tools (bash, background_run, exec_command, mcp:*) and apply_mode clears hitl_classes in every shipped mode, so authorize returns Allow for any tool outside that set before pattern rules are consulted. git is outside it, and GitTool's own argument policy permits -u/--set-upstream-to. Nothing downstream catches a misclassification. So readonly.rs is the boundary, not a layer above one, and #381 closed an approval bypass rather than fixing a cosmetic label: a mutating git command classified as a read became an unprompted mutation. Corrects the module header, the branch_is_readonly doc and the test comment, and pins the mechanism with two tests so it cannot be misread again: bash prompts while the rewritten git call is allowed outright, and both shipped modes leave hitl_classes empty.
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
…#383) The comments added in #381 claimed the git branch misclassification was never exploitable because GitTool is SideEffectClass::Write and authorize still gates it. That is wrong, and it is wrong in the direction that matters. Approval is gated on tool identity, not side-effect class. hitl_tools holds the shell-equivalent tools (bash, background_run, exec_command, mcp:*) and apply_mode clears hitl_classes in every shipped mode, so authorize returns Allow for any tool outside that set before pattern rules are consulted. git is outside it, and GitTool's own argument policy permits -u/--set-upstream-to. Nothing downstream catches a misclassification. So readonly.rs is the boundary, not a layer above one, and #381 closed an approval bypass rather than fixing a cosmetic label: a mutating git command classified as a read became an unprompted mutation. Corrects the module header, the branch_is_readonly doc and the test comment, and pins the mechanism with two tests so it cannot be misread again: bash prompts while the rewritten git call is allowed outright, and both shipped modes leave hitl_classes empty.
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
…#383) The comments added in #381 claimed the git branch misclassification was never exploitable because GitTool is SideEffectClass::Write and authorize still gates it. That is wrong, and it is wrong in the direction that matters. Approval is gated on tool identity, not side-effect class. hitl_tools holds the shell-equivalent tools (bash, background_run, exec_command, mcp:*) and apply_mode clears hitl_classes in every shipped mode, so authorize returns Allow for any tool outside that set before pattern rules are consulted. git is outside it, and GitTool's own argument policy permits -u/--set-upstream-to. Nothing downstream catches a misclassification. So readonly.rs is the boundary, not a layer above one, and #381 closed an approval bypass rather than fixing a cosmetic label: a mutating git command classified as a read became an unprompted mutation. Corrects the module header, the branch_is_readonly doc and the test comment, and pins the mechanism with two tests so it cannot be misread again: bash prompts while the rewritten git call is allowed outright, and both shipped modes leave hitl_classes empty.
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.
Corrects comments introduced in #381 that describe the security model incorrectly, and pins the real mechanism with tests.
The wrong claim
#381 stated — in the
branch_is_readonlydoc, a test comment, and its own PR description — that thegit branchmisclassification "was never exploitable" becauseGitToolisSideEffectClass::Write, soauthorizestill gates it.That is wrong, and wrong in the direction that matters.
What actually happens
Approval is gated on tool identity, not side-effect class:
hitl_toolsdefaults to the shell-equivalent tools —bash,background_run,exec_command,mcp:*.hitl_classesdefaults to empty, andapply_modeclears it in both shipped modes (Manual and Accept Edits).authorizereturnsAllowfor any tool in neither set, before pattern rules are consulted.gitis in neither set. SoSideEffectClass::WriteonGitToolhas no gating effect at all — as the pre-existingnon_hitl_tools_still_allowed_without_promptingalready asserts forwrite_file. AndGitTool's own argument policy explicitly permits-uand--set-upstream-to(builtins.rs), so it does not reject them either.There is no second gate below
readonly.rs.Consequence
readonly.rsis the security boundary, not a layer above one. A rewrite turns a call that would have prompted into one authorized outright — that is the entire purpose of the rewrite. So classifying a mutating git command as a read is an approval bypass, not a cosmetic mislabel:git branch --set-upstream-to=…,-u<upstream>,--unset-upstreamand--edit-descriptionwere unprompted repository mutations before #381.#381's fix was correct and remains correct. Only the reasoning recorded alongside it was wrong — which matters, because that reasoning is what a future reader would rely on when deciding how careful this classifier has to be.
Changes
branch_is_readonlydoc corrected to describe identity-based gating and the absence of a downstream catch.rewritten_git_calls_are_not_prompted—bashprompts (Hitl), the rewrittengitcall isAllow, making the privilege delta explicit.shipped_modes_leave_hitl_classes_empty— both modes clearhitl_classes, so class-based gating never applies unless a caller opts in by hand.No behavior change; comments and tests only.
Verification
cargo fmt --all -- --check,cargo clippy --workspace --all-targets --locked -- -D warnings, andcargo test --workspace --locked --no-fail-fastall green ona704821.forge-governance87 → 89.