fix(filesystem): sanitize error messages to prevent path info disclosure#3371
Closed
aptsalt wants to merge 1 commit intomodelcontextprotocol:mainfrom
Closed
fix(filesystem): sanitize error messages to prevent path info disclosure#3371aptsalt wants to merge 1 commit intomodelcontextprotocol:mainfrom
aptsalt wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
…disclosure Remove internal filesystem paths from validatePath() error messages to prevent leaking directory structure in shared environments. Pin npx examples in README to @0.6.3 to mitigate supply chain risk. Closes #3317
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
validatePath()error messages insrc/filesystem/lib.tsto stop exposing absolute paths and allowed directory lists in error outputnpxexamples insrc/filesystem/README.mdto@0.6.3to mitigate supply chain risk from unpinned package resolutionContext
Addresses the 2 low-severity findings from the AgentAudit security report in #3317:
Error messages expose internal path information —
validatePath()included the full requested path and the complete allowed directory list in thrown errors. In shared or multi-tenant environments, this could leak directory structure to unauthorized callers.NPX usage without version pinning — Documentation examples used
npx -y @modelcontextprotocol/server-filesystemwithout a version specifier, creating a supply chain risk if a malicious version were published.Changes
src/filesystem/lib.tssrc/filesystem/README.md@modelcontextprotocol/server-filesystem@0.6.3src/filesystem/__tests__/lib.test.tsdoes not leak filesystem paths in access denied errors— verifies error message contains no path or directory infodoes not leak filesystem paths in parent directory errors— verifies parent path is not leakeddoes not leak filesystem paths in symlink denied errors— verifies symlink target path is not leakedTest plan
npx vitest run __tests__/lib.test.ts)tsc --noEmitpasses with no type errorsCloses #3317