bug: doc-map config loaded from PR branch (untrusted) — potential data exfiltration #143
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The
validate-docmapand doc-map injection features read the doc-map YAML config from the PR branch, not the default/trusted branch. A malicious PR author can modify the doc-map in their branch to cause arbitrary repo documents to be fetched from the default branch and injected into LLM requests.Impact
Attack vector
.review-bot/doc-map.ymlin their branch to map any path glob to sensitive docs (e.g.,docs/internal/secrets.md)Fix
The doc-map config file must always be loaded from the default branch (or a pinned trusted ref), never from the PR branch. The PR branch should only contribute the list of changed files — not the config that governs what docs get injected.
References
review/docmap.go, action inputs, CLI flag handling🔍 Triage note (from DESIGN-137-doc-map.md):
The design doc states:
In CI, "local workspace" is the checked-out PR branch. The design doc describes
GetAllFilesInPathandGetFileContentfetching docs via VCS API — but the config itself comes from the workspace.Affected components per design:
review/docmap.go— YAML parsing, glob matching, doc loadingcmd/review-bot/main.go— Step 6c: parses configaction.yml—doc-mapinput wired toDOC_MAP_FILEFix approach: load
.review-bot/doc-map.ymlvia VCS API from the default branch (like patterns-repo fetch) instead of from the local workspace. This may require a new flag or env var for "trusted ref".