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.
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