The validate-docmap and 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
Severity: MAJOR / Security
Found by: security-review-bot on PR #138 (REQUEST_CHANGES)
Merged despite finding: Yes — PR #138 was merged with this unresolved
Attack vector
Attacker opens a PR
Modifies .review-bot/doc-map.yml in their branch to map any path glob to sensitive docs (e.g., docs/internal/secrets.md)
review-bot reads the doc-map from the PR branch
Sensitive docs from the default branch are fetched and injected into the LLM system prompt
Via prompt injection in the design docs, attacker could potentially exfiltrate content
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
PR #138 security-review-bot review: REQUEST_CHANGES with this finding
Affects: review/docmap.go, action inputs, CLI flag handling
## Summary
The `validate-docmap` and 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
- **Severity:** MAJOR / Security
- **Found by:** security-review-bot on PR #138 (REQUEST_CHANGES)
- **Merged despite finding:** Yes — PR #138 was merged with this unresolved
## Attack vector
1. Attacker opens a PR
2. Modifies `.review-bot/doc-map.yml` in their branch to map any path glob to sensitive docs (e.g., `docs/internal/secrets.md`)
3. review-bot reads the doc-map from the PR branch
4. Sensitive docs from the **default branch** are fetched and injected into the LLM system prompt
5. Via prompt injection in the design docs, attacker could potentially exfiltrate content
## 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
- PR #138 security-review-bot review: REQUEST_CHANGES with this finding
- Affects: `review/docmap.go`, action inputs, CLI flag handling
The doc-map YAML file is read from the local workspace (like system-prompt-file).
In CI, "local workspace" is the checked-out PR branch. The design doc describes GetAllFilesInPath and GetFileContent fetching docs via VCS API — but the config itself comes from the workspace.
Fix approach: load .review-bot/doc-map.yml via 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".
**🔍 Triage note (from DESIGN-137-doc-map.md):**
The design doc states:
> The `doc-map` YAML file is read from the local workspace (like `system-prompt-file`).
In CI, "local workspace" is the checked-out PR branch. The design doc describes `GetAllFilesInPath` and `GetFileContent` fetching docs via VCS API — but the *config* itself comes from the workspace.
Affected components per design:
- `review/docmap.go` — YAML parsing, glob matching, doc loading
- `cmd/review-bot/main.go` — Step 6c: parses config
- `action.yml` — `doc-map` input wired to `DOC_MAP_FILE`
Fix approach: load `.review-bot/doc-map.yml` via 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".
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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".