filesystem: add stable fail-closed path validation reason codes - #3526
filesystem: add stable fail-closed path validation reason codes#3526davidahmann wants to merge 1 commit into
Conversation
|
This change makes filesystem deny paths auditable by attaching stable reason codes to fail-closed validation errors. |
|
@claude review |
|
Claude finished @cliffhall's task in 1m 21s —— View job PR Review
SummaryThe design is sound — exporting Critical Bug —
|
LuuOW
left a comment
There was a problem hiding this comment.
Technical audit: Verified MCP server implementation for consistency with current SDK patterns.
Human AppSec re-check (2026-09)Confirming @claude's Apr review still applies on current HEAD: Blocking: in the ENOENT parent-realpath path, Suggested fix: Tests: upgrade the outside-allowlist case from message substring to Related fix PR (same catch-swallow / reason-code contract): #4789 — happy to align or close in favor of a fixed #3526. Verdict: Request changes (posted as a conversation comment — formal review submit is disabled without explicit review permission on this repo). |
Problem
Filesystem path validation denied symlink traversal outside allowed directories, but denials were only free-form strings. Callers had no stable machine-readable reason classification.
Why now
Fail-closed behavior is already present; adding stable reason codes makes denial paths contract-testable and auditable without brittle string parsing.
What changed
PathValidationErrorwith stablereasonvalues for path validation denials.validatePathto emit reason-coded errors for outside-allowed, symlink-target escape, parent-outside, and missing-parent cases.Validation
pnpm vitest src/filesystem/__tests__/lib.test.ts -t "stable reason code"Refs #3525