Repository navigation
fix(security): redact reads of raven's own oauth token files - #917
Open
akushonkamen wants to merge 1 commit into
Open
akushonkamen wants to merge 1 commit into
akushonkamen wants to merge 1 commit into
Conversation
The workspace false-positive fix in EverMind-AI#833 exempted all of raven's home from the home-dotfile pattern pass, on the grounds that raven's own keys are taken out by the exact-match pass over config.json. The sign-in token files under the oauth directory (oauth/chatgpt/auth.json, github_copilot, minimax, litellm) are collected by neither pass, so a turn that read one handed the access and refresh tokens to the model, the session record and the provider's logs. Narrow the exemption to the two places a coding turn reads its own source, the workspace and the scratch directories; the rest of raven's home -- the token store first -- stays under the pass. Fixes EverMind-AI#842. Co-authored-by: Claude (GLM-5.3-Flash) <noreply@anthropic.com>
This branch has not been deployed
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
A turn that read one of Raven's own OAuth token files handed the access and refresh tokens to the model, the session record and the provider's logs. The workspace false-positive fix in #833 exempted all of Raven's home from the home-dotfile pattern pass on the grounds that Raven's own keys are taken out by the exact-match pass over
config.json-- but that pass readsconfig.jsononly (raven/config/held_secrets.py), so the token files under~/.raven/oauth/<provider>/are collected by neither pass.This PR narrows the exemption in
_home_config()(raven/security/redact.py) from Raven's whole home to the two places a coding turn reads its own source, the workspace and the scratch (tmp) directories, their backslash spellings and path boundary kept. The rest of Raven's home, the token store first, goes back under the pattern pass: a read ofoauth/chatgpt/auth.json,oauth/github_copilot/access-token,oauth/minimax_global.json, or acatof one, is redacted like another program's settings read. The_home_config()docstring, which said the exact-match pass already covers Raven's own keys, is corrected. The workspace and tmp directories stay exempt, so the false positives #833 fixed do not come back.This is the fix suggested in #842, announced in my claim comment there.
Type
Verification
The issue's reproduction script, before this change: the oauth file came back unchanged while the codex file was redacted. After this change, the same script redacts both.
timeout 600 uv run --frozen --all-extras pytest tests/test_security_untrusted_context.py -q: 25 passed, including the newtest_ravens_own_oauth_tokens_are_redacted_like_another_programs(reads ofoauth/chatgpt/auth.json,oauth/github_copilot/access-token,oauth/minimax_global.jsonandcat oauth/chatgpt/auth.jsonall come back redacted, whilels ~/.ravenand a read outside the home stay unchanged) next to the existing feat: let raven read and change its own configuration #833 exemption tests.timeout 590 uv run --frozen --all-extras pytest tests -q --ignore=tests/manual: 28194 passed, 4 failed, 118 skipped. The 4 fail on this machine with the change stashed on a clean main too, so they are pre-existing and unrelated: ana2a_interopscheme case,test_rpc_files(LibreOffice is installed here), and the two simulation cases also listed in feat: let raven read and change its own configuration #833's verification notes.uv run --frozen python -m scripts.check_commit_messages main..HEAD: exit 0.uv run --frozen ruff checkanduv run --frozen ruff format --checkon the two changed files: pass.uv run --frozen lint-imports: 10 contracts kept, 0 broken.Relevant tests pass locally
Relevant lint / type checks pass locally
User-facing docs or screenshots are updated when needed
Risk
Security impact: this is the fix. From this change on, a tool result that reaches into Raven's own token store loses its tokens before it reaches the model, the session record and the provider's logs. The workspace and tmp exemption stays, and reads whose arguments never reach the home are untouched, so no redaction noise appears outside Raven's home.
Backward compatibility: no interface, config or stored-format change. The only behaviour change is that a read of Raven's own home outside workspace and tmp is now pattern-redacted, which is the protection the release before feat: let raven read and change its own configuration #833 never had and feat: let raven read and change its own configuration #833 intended to give.
Rollback: revert the single commit; no migration, no data change.
Security impact considered
Backward compatibility considered
Rollback path is clear for risky changes
Related Issues
Fixes #842