feat(security): require MCP_UPLOAD_BASE_DIR for the upload-PRD tool - #411
Merged
gaurav-singh-9227 merged 2 commits intoSep 11, 2026
Merged
Conversation
uploadProductRequirementFile now refuses unless the operator has set MCP_UPLOAD_BASE_DIR to an allowed directory; when set, uploads are confined to that directory (existing validateUploadPath containment). This makes file uploads opt-in instead of accepting arbitrary local paths. - upload-file.ts: refuse with clear guidance when MCP_UPLOAD_BASE_DIR is unset; file_path schema now documents the base-dir requirement. - tests: gate refuses when unset, and passes through when set. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited), Workspace UI (inherited) Review profile: ASSERTIVE Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gaurav-singh-9227
approved these changes
Sep 11, 2026
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
Makes the
uploadProductRequirementFiletool opt-in: it works only when the operator has set theMCP_UPLOAD_BASE_DIRenvironment variable to an allowed directory, and uploads are confined to that directory. Without it, the tool refuses instead of accepting an arbitrary local file path.This closes the residual gap in the upload path:
validateUploadPathalready blocks traversal / hidden-dir / bad-extension / oversized files, and supports a base-directory jail — but that jail was previously optional. This change makes it required for the document/attachment upload tool, so a caller (or a prompt-injected agent) can't have the tool read files from anywhere on disk.Changes
testmanagement-utils/upload-file.ts: refuse with clear guidance whenMCP_UPLOAD_BASE_DIRis unset ("set it and restart; uploads are restricted to that directory"). When set, the existingvalidateUploadPathcontainment applies.file_pathschema description now documents the base-dir requirement.Scope
Applies to the document/attachment upload tool (
uploadProductRequirementFile). App-binary uploads (App Live / App Automate) keep their current behaviour (traversal/hidden-dir/extension/size guards remain in force viavalidateUploadPath).Testing
tsc --noEmitclean; eslint clean;tests/tools/uploadFile.test.tspasses (2).🤖 Generated with Claude Code