Skip to content

fix(config): do not follow repository-controlled symlinks when indexing - #596

Open
carfeii wants to merge 1 commit into
AsyncFuncAI:mainfrom
carfeii:fix/symlink-escape-during-indexing
Open

carfeii wants to merge 1 commit into
AsyncFuncAI:mainfrom
carfeii:fix/symlink-escape-during-indexing

Conversation

@carfeii

@carfeii carfeii commented Oct 5, 2026

Copy link
Copy Markdown

iterate_files() walked a repository with Path.rglob() and called is_file(), which follows symlinks, with no is_symlink() guard. A repository containing a symlink pointing outside the clone (to any file the server process can read) would have that symlink listed alongside real files, and the RAG indexer's open() on it dereferences straight to the external target, embedding and persisting its content.

Skips any symlink encountered during the walk instead of following it.

Test plan

  • pytest tests/test_config.py: new regression test passes.
  • pytest tests/: full suite passes with no regressions.
  • Confirmed the new test fails against the pre-fix code (the symlinked file was listed and its external target's content returned).

iterate_files() walked a repository with Path.rglob() and called
is_file(), which follows symlinks, with no is_symlink() guard. A
repository containing a symlink pointing outside the clone (to any
file the server process can read) would have that symlink listed
alongside real files, and the RAG indexer's open() on it dereferences
straight to the external target, embedding and persisting its content.

Skip any symlink encountered during the walk instead of following it.

Adds a regression test in tests/test_config.py, including fail-before
coverage run against the unpatched code.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant