fix(security): expand denylist to block /proc subtree (#29) - #35
Conversation
Replace the specific /proc/self/environ entry in blockedPrefixes with /proc to block the entire /proc subtree via the existing prefix-match loop. This closes the gap where /proc/self/maps, /proc/self/fd/*, and /proc/1/environ were accessible despite containing sensitive runtime data (memory layout, open file descriptors, environment variables for arbitrary PIDs). The withSep prefix-match logic already handles subtree blocking correctly — only the entry value needed to change. Also adds tests/unit/upload-validator.test.ts (19 tests) covering /proc subtree blocking, home-dir sensitive paths, .env blocking, COMET_UPLOAD_ROOT allowlist enforcement, and error cases.
Security Review — PR #35Reviewed commit: Findings SummaryNo blocking security issues found. Analysis1. Core Fix Verification — prefix correctnessThe change replaces The prefix-match loop (lines 121–129): const withSep = prefix.endsWith(PATH_SEP) ? prefix : prefix + PATH_SEP;
if (real === prefix || real.startsWith(withSep)) { throw ... }For
False positive check: 2. Test Coverage AssessmentTests correctly stub 3. No Injection, SSRF, or Other Vulnerabilities
4. Broader Denylist Coverage CheckNo gaps identified: the fix specifically addresses the issue's scope. Note for future: Verdict: APPROVED. The fix is correct, minimal, and well-tested. Safe to merge. |
RapierCraft
left a comment
There was a problem hiding this comment.
APPROVED: commit 8b5e8a8 after context-aware security review (1 agent: General Security). 0 findings. Safe to merge.
- Build: PASS (tsc clean)
- Tests: 19/19 new tests pass; 2 pre-existing failures in unrelated cdp-client.screenshot.test.ts are not introduced by this PR
- Security: fix correctly blocks entire /proc subtree via withSep prefix match; no false positives for /procdata paths
- No blocking issues found
PR Review Summary: #35 — fix(security): expand denylist to block /proc subtree (#29)Review IntegrityReviewed commit: Verdict: APPROVEDContext-Aware ReviewDomains: Security | Agents: 1 (General Security) Integration Checks (Phase 2.5)Code registration: PASS — no new exports or router registrations needed Risk Matrix
FindingsNo findings — review is clean. Automated Checks
RecommendationMerged. The 1-line fix correctly expands to in the denylist, blocking the entire /proc subtree via the existing prefix-match pattern. 19 portable unit tests added. Context-aware review complete. 1 agent + integration checks. 0 findings triaged. PR merged to |
Summary
Expands the upload path denylist to block the entire
/procsubtree instead of the single leaf path/proc/self/environ. The/procfilesystem exposes sensitive runtime data — memory maps, open file descriptors, environment variables — for arbitrary PIDs, all of which appear as regular files and would previously have passed validation.Changes
src/upload-validator.ts: Replace"/proc/self/environ"with"/proc"inblockedPrefixes— blocks entire subtree via existing prefix-match looptests/unit/upload-validator.test.ts: New file with 19 unit tests covering /proc subtree blocking, home-dir sensitive paths, .env blocking, COMET_UPLOAD_ROOT allowlist, and error casesTesting
/proc/self/environblocked [type:unit]/proc/self/mapsblocked [type:unit]/proc/self/fd/0blocked [type:unit]/proc/1/environblocked [type:unit]/proc/12345/memblocked [type:unit]Closes #29
Implementation branch:
fix/expand-proc-denylist-29Base:
main