Repository navigation
Harden auto-approve edit gate: treat shell-rc and config-execution files as sensitive - #63438
spartan8806 wants to merge 2 commits into
Conversation
…sitive The auto-approve edit gate keeps "sensitive" paths prompting even under autonomous policies, but the sensitive-path check only covered .env files, SSH private keys, and .git/.ssh path components. It missed shell startup files (.bashrc, .zshrc, .profile, ...), .gitconfig, .npmrc, and user persistence locations (.config/autostart, .config/systemd). Under the session auto-approve policy those were written without a prompt, which is an easy way to get code to run at the next shell, git invocation, or login. This expands the sensitive-name set to cover shell and tool rc/config files, treats any dotfile directly in the user's home directory as sensitive, and adds autostart/systemd path components. Ordinary in-project edits still auto-approve; only home-directory config and persistence files now prompt. Hardening improvement per SECURITY.md 3.2 (the approval gate can catch more patterns). Co-Authored-By: Claude Opus 4.8 <[email protected]>
teknium1
left a comment
There was a problem hiding this comment.
Thanks for hardening the ACP edit gate. The reported single-file gap is present on current main: acp_adapter/edit_approval.py:192-209 does not classify shell RC/config paths as sensitive, and the requester bypasses the prompt when that predicate permits the session policy (acp_adapter/edit_approval.py:299-304).
Problems
acp_adapter/edit_approval.py:164represents multi-file V4A targets as", ".join(paths). The proposed check evaluates that combined display string as onePath, so a mixed patch containing~/.bashrccan still bypass the prompt under the session policy. Preserve and evaluate each V4A target independently.- The diff changes only
acp_adapter/edit_approval.py; it adds no regression tests. Current coverage attests/acp/test_edit_approval.py:247-269checks only.env, not the proposed shell/config/persistence paths or multi-file V4A behavior.
Suggested changes
- Carry the individual V4A target paths through the proposal/security decision, while retaining the joined path only for display.
- Add focused tests for the new protected paths and a mixed sensitive/non-sensitive V4A patch.
Automated hermes-sweeper review.
…add regression tests Carry the individual V4A target paths through EditProposal.target_paths so the sensitivity and workspace-containment checks evaluate each real path instead of the ", ".join(...) display string. Fixes the multi-file bypass where a sensitive or out-of-workspace file that is not the trailing path could still auto-approve. Adds regression tests for the new protected paths and multi-file V4A behavior. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01D9UWNzd6Zh4MNsGdqMDm5t
|
Following up on this — the two items from the review are addressed:
Happy to rebase or adjust anything if the approach isn't what you had in mind. |
|
suggesting changes The patch improves ACP edit approval for V4A targets and several sensitive locations, but executable shell startup/configuration files outside the current sensitive-name and directory rules can still be auto-approved. A model-controlled edit to one of those files can persist code without an ACP permission request.
Security evidence:
Review setup: I reviewed a run-owned local rebase or patch replay against current GitHub Not checked:
Signed: GPT-5.6-luna-max in Codex |
|
Thanks for the review, this is a fair catch and I agree with it. A name-based allowlist was the Before I push a fix I want to check the intended scope with you, because I think the gap is wider The canonical policy you pointed me at, If I am reading that correctly it would also affect the shell-command path and not just ACP edits, I did not want to touch a shared predicate the command path depends on, so I have not changed it. My Happy to go a different direction if you have one in mind. It is your call and I do not want to Two smaller things:
Let me know which scope you want and I will get it up. |
Harden auto-approve edit gate: treat shell-rc and config-execution files as sensitive
|
What
Expands the auto-approve edit gate's sensitive-path check (
acp_adapter/edit_approval.py) so it also treats shell startup files, tool config files, and user persistence locations as sensitive, so they keep prompting even under autonomous policies.Why
should_auto_approve_editintentionally keeps sensitive paths prompting even under autonomous policies (its docstring: "sensitive paths still ask even under autonomous policies"). But_is_sensitive_auto_approve_pathonly covered.env*,id_rsa/id_ed25519, and.git/.sshpath components. It missed the files that most directly lead to code execution or persistence:.bashrc,.bash_profile,.profile,.zshrc,.zshenv, ... (run at the next shell/login).gitconfig(alias/pager gadgets),.npmrc,.pypirc,.netrc,.envrc.config/autostart/*.desktop,.config/systemd/user/*.serviceUnder the
sessionauto-approve policy these were written with no prompt, which is an easy path to running attacker-influenced content at the next shell/git/login.Change
autostart/systemdto the sensitive path components.Ordinary in-project edits still auto-approve; only home-directory config and persistence files now prompt. Offered as a hardening improvement per SECURITY.md §3.2 ("the approval gate can always catch more patterns").
Verified the change blocks the files above under every non-ask policy while leaving normal in-project file edits auto-approving.