Skip to content

feat(security): require MCP_UPLOAD_BASE_DIR for the upload-PRD tool - #411

Merged
gaurav-singh-9227 merged 2 commits into
browserstack:mainfrom
SavioBS629:security/pmaa-107-upload-basedir
Sep 11, 2026
Merged

feat(security): require MCP_UPLOAD_BASE_DIR for the upload-PRD tool#411
gaurav-singh-9227 merged 2 commits into
browserstack:mainfrom
SavioBS629:security/pmaa-107-upload-basedir

Conversation

@SavioBS629

Copy link
Copy Markdown
Collaborator

Summary

Makes the uploadProductRequirementFile tool opt-in: it works only when the operator has set the MCP_UPLOAD_BASE_DIR environment 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: validateUploadPath already 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 when MCP_UPLOAD_BASE_DIR is unset ("set it and restart; uploads are restricted to that directory"). When set, the existing validateUploadPath containment applies.
  • file_path schema description now documents the base-dir requirement.
  • Tests: refuses when unset; passes the gate when set.

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 via validateUploadPath).

Testing

tsc --noEmit clean; eslint clean; tests/tools/uploadFile.test.ts passes (2).

🤖 Generated with Claude Code

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>
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited), Workspace UI (inherited)

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 22b69454-4a8e-4140-b612-3ac0ee694163

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gaurav-singh-9227
gaurav-singh-9227 merged commit ed2690e into browserstack:main Sep 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants