security: tool output scrubbing misses raven's own oauth token files
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
Start in raven/config/held_secrets.py at scrub_tool_output and trace _home_config(), then compare the pattern handling in raven/security/redact.py. Update the exclusion scope and its docstring so OAuth files remain covered by pattern redaction while workspace and tmp paths do not. Verify the behavior in tests/test_security_untrusted_context.py with uv run pytest -q tests/test_security_untrusted_context.py.
Written by the indexing model from the issue text.
Description
Problem
Tool output scrubbing (added in #833) does not cover Raven's own OAuth token files, so a turn that reads one hands the access and refresh tokens to the model.
Two passes scrub a tool result before a model sees it (raven/config/held_secrets.py scrub_tool_output):
scrub_held_secrets-- exact match on the values inconfig.jsononly;redact_home_config_read(raven/security/redact.py) -- pattern redaction when the call reaches into a dot-directory of the home.
The fix for the workspace false positive in #833 made _home_config() skip all of Raven's home (~/.raven), on the grounds that Raven's own keys are covered by pass 1. That holds for config.json, but not for the sign-in tokens under get_oauth_dir() (~/.raven/oauth/<provider>/...: chatgpt/auth.json, github_copilot/, MiniMax, litellm). They are in neither pass.
Repro
With #833 in, using a fake token:
import os
from raven.config.held_secrets import scrub_tool_output
home = os.path.expanduser("~")
tok = '{"access_token": "eyJhbGciOiJSUzI1NiJ9.FAKEPAYLOAD.sig", "refresh_token": "rt_FAKE0123456789abcdef"}'
print(scrub_tool_output({"path": f"{home}/.raven/oauth/chatgpt/auth.json"}, tok)) # unchanged
print(scrub_tool_output({"path": f"{home}/.codex/auth.json"}, tok)) # [redacted]
A refresh token is a long-lived account credential; once in a tool result it is in the session record and the provider's logs. The self-config skill tells the agent not to open credential stores, but #833's own measurement is that a model diagnosing an agent reads its settings anyway.
Suggested fix
Narrow the exclusion in _home_config() from Raven's whole home to the directories where a coding turn reads its own source: <raven home>/workspace and <raven home>/tmp (and the bound workdir). ~/.raven/oauth/... and the rest of Raven's home then stay under the pattern pass. Correct the _home_config() docstring, which says Raven's own keys are covered by the exact-match pass.
Verify: in tests/test_security_untrusted_context.py, assert a read of ~/.raven/oauth/<provider>/auth.json is redacted, next to the existing case that ~/.raven/workspace/... and ~/.raven/tmp/... stay unchanged; uv run pytest -q tests/test_security_untrusted_context.py.
Not a regression against the release before #833 (there was no scrubbing then); a gap in the new protection.
- Dominant language
- Python
- Stars
- 4.1k
- Forks
- 94
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 209
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from EverMind-AI/Raven
-
fix(tui): a skipped DAG node read from a snapshot shows a 0s durationPossibly taken @yudongyouqing claimed this 3 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
EverMind-AI/Raven#1000 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
EverMind-AI/Raven#998 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
EverMind-AI/Raven#997 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
EverMind-AI/Raven#121 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 67/100
EverMind-AI/Raven#1085 ·
Maintainers usually reply within 1 day
All issues in EverMind-AI/Raven
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Arekkazu/sgpmp-backend#744 ·
Maintainers usually reply within 1 day
-
agent/reviewer
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
projectbluefin/utah-packages#634 ·
Maintainers usually reply within 1 day
-
enhancement good first issue help wanted
Difficulty 2/5 1-2 days Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
home-assistant/core#188613 ·
Maintainers usually reply within 1 day
-
WebsiteOpengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
TanbirRamim/open-source-radar#314 ·
Maintainers usually reply within 1 day