fix(memory_engine): guard RAVEN_HOME in project skill roots
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 22/100
Research direction
Start in raven/memory_engine/skill_forge/project_skills.py, where guarded and excluded are built in project_skill_roots and read_project_skills calls _is_guarded before build_skill_meta. Reproduce the leak with a test in tests/test_skill_forge_project_skills.py: a repo containing RAVEN_HOME, a SKILL.md symlinked to config.json, and an agent_home outside RAVEN_HOME. Done means the secret content no longer appears in SkillMeta. Linked PR #1390 is already open against this issue, so check it before starting.
Written by the indexing model from the issue text.
Description
What happens
project_skill_roots protects two trees from being read as project skills:
guarded = (home/.agents, agent_home)-- checked when a SKILL.md is readexcluded = {home, agent_home, *agent_home.parents}-- directories that may not become the git-root boundary
RAVEN_HOME (default ~/.raven, from raven.home.raven_home()) is not in guarded. It is covered only indirectly, as a parent of the default agent_home (RAVEN_HOME/workspace), through the unconditional *agent_home.parents set.
agents.defaults.workspace accepts any path and is not validated against RAVEN_HOME: Config.workspace_path uses an explicitly configured value as written. When that workspace points outside RAVEN_HOME, nothing keeps RAVEN_HOME out of the boundary search or out of the guarded check. A repository that contains RAVEN_HOME then becomes the git-root boundary, and a project skill whose SKILL.md symlinks to <RAVEN_HOME>/config.json is read as a project skill. That file holds provider API keys.
Reproduction
Layout:
repo/.git
repo/.raven/config.json <- RAVEN_HOME, holds provider keys
repo/src/ <- the turn's workdir
repo/src/.agents/skills/setup/SKILL.md -> repo/.raven/config.json
# agents.defaults.workspace (agent_home) configured outside the repo
repo/.raven/config.json held {"providers": {"openai": {"api_key": "sk-SECRET"}}} (a fake value).
Against the current main:
roots = project_skill_roots(src, agent_home=agent_home_outside, home=userhome)
# ProjectRoots(dirs=(.../repo/src/.agents/skills,), boundary=.../repo,
# guarded=(.../userhome/.agents, .../agent_home_outside))
metas = read_project_skills(roots)
# SkillMeta(name='setup', source='project',
# content='{"providers": {"openai": {"api_key": "sk-SECRET"}}}')
_format_skill_text(meta) returns the secret, so it reaches the BM25 index and every search or injection path built on it.
The same layout with the default agent_home (RAVEN_HOME/workspace) does not leak: repo is in excluded through agent_home.parents, git_root is dropped, boundary becomes src, and the symlinked SKILL.md resolves outside the boundary. The leak is triggered by the workspace setting, not by the skill layout.
A sibling layout leaks the same way: a checkout that contains the home, with the workdir outside it and agent_home outside RAVEN_HOME.
Why this is not #1354
#1354 stops a git root above the user's home from becoming the skill boundary. It does not address RAVEN_HOME.
guarded and excluded are identical on origin/main and on the branch checked here, and the leak reproduces with neither of #1354's changes applied. It is a pre-existing gap, not a regression from that PR.
Suggested fix
Add RAVEN_HOME directly to guarded:
- The payload is stopped at read time:
read_project_skillscalls_is_guarded(skill_file, roots.guarded)beforebuild_skill_meta, so a symlink that leaves the project cannot resolve to the config file. - With
RAVEN_HOMEguarded, the unconditional*agent_home_r.parentsexclusion can be relaxed: the conservative trade-off where a checkout that contains the agent home collects no repository skills is no longer needed to keepRAVEN_HOMEout. - This also closes the workspace-configured-outside-RAVEN_HOME surface.
Implementation notes:
ProjectSkills.__init__must receiveraven_home(); today it only carriesagent_home, androots()callsproject_skill_roots(workdir, agent_home=...)withhomedefaulting toNone.guardedis process-stable, so adding it to the cache key carries little semantic risk (_cache_keycurrently keys ondirsplusboundary).- Assembly points:
raven/agent/loop/wiring.py:1525andraven/context_engine/factory.py:292.
Files
raven/memory_engine/skill_forge/project_skills.py--guardedat:65,excludedat:66,ProjectSkillsat:295raven/agent/loop/wiring.py:1525andraven/context_engine/factory.py:292-- assembly points that needraven_home()passed intests/test_skill_forge_project_skills.py-- add a payload test for the workspace-outside-RAVEN_HOME layout
- Dominant language
- Python
- Stars
- 4.1k
- Forks
- 94
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 216
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
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
EverMind-AI/Raven#1413 ·
Maintainers usually reply within 1 day
-
feat: allow users to build ui-web and ui-tui with `bun`May be free again @0warning0error claimed this 8 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
EverMind-AI/Raven#1283 · 2 comments ·
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
-
fix: Feishu channel status wrongly reports missing credentials and "not connected" while WebSocket is livePossibly taken @pcbeingused333 claimed this 1 day ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 18/100
EverMind-AI/Raven#1399 · 1 comment ·
Maintainers usually reply within 1 day
-
WebUI tab froze silently while gateway stayed healthy (heartbeat stopped 1h49m); reproducible /auth refresh dead-end fixed in #1392Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 22/100
EverMind-AI/Raven#1393 · 2 comments ·
Maintainers usually reply within 1 day
All issues in EverMind-AI/Raven
Similar issues
-
bug docs
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
ActivityWatch/docs#223 ·
-
[Bug]: OpenCode v2 skips an assistant message that gains text after an earlier capturePossibly taken @jianyx1 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
volcengine/OpenViking#8354 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ARTPARK-SAHAI-ORG/calibrate-frontend#842 ·
Maintainers usually reply within 1 day
-
comp/tools P2 tool/skills type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NousResearch/hermes-agent#159541 ·
Maintainers usually reply within 1 day