fix(memory_engine): guard RAVEN_HOME in project skill roots

Open
#1,388 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@pcbeingused333 is already working on this.

Since Nov 21, 2026.

  • #1390 by @pcbeingused333 — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
22/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend, security

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

bug security

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 read
  • excluded = {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:

  1. The payload is stopped at read time: read_project_skills calls _is_guarded(skill_file, roots.guarded) before build_skill_meta, so a symlink that leaves the project cannot resolve to the config file.
  2. With RAVEN_HOME guarded, the unconditional *agent_home_r.parents exclusion can be relaxed: the conservative trade-off where a checkout that contains the agent home collects no repository skills is no longer needed to keep RAVEN_HOME out.
  3. This also closes the workspace-configured-outside-RAVEN_HOME surface.

Implementation notes:

  • ProjectSkills.__init__ must receive raven_home(); today it only carries agent_home, and roots() calls project_skill_roots(workdir, agent_home=...) with home defaulting to None.
  • guarded is process-stable, so adding it to the cache key carries little semantic risk (_cache_key currently keys on dirs plus boundary).
  • Assembly points: raven/agent/loop/wiring.py:1525 and raven/context_engine/factory.py:292.

Files

  • raven/memory_engine/skill_forge/project_skills.py -- guarded at :65, excluded at :66, ProjectSkills at :295
  • raven/agent/loop/wiring.py:1525 and raven/context_engine/factory.py:292 -- assembly points that need raven_home() passed in
  • tests/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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from EverMind-AI/Raven

All issues in EverMind-AI/Raven

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.