Skip to content

feat(filesystem): add --ignore-write option to block writes to sensit… #1901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

SOURABHMISHRA5221
Copy link

@SOURABHMISHRA5221 SOURABHMISHRA5221 commented May 24, 2025

Title:
feat(filesystem): add --ignore-write option to block writes to sensitive files (#1869)

Description:
This PR addresses issue #1869 by adding a flexible mechanism to prevent accidental overwrites of sensitive files (such as .env) in the Filesystem MCP server.

Summary of changes:

  • Added a --ignore-write <pattern1> <pattern2> ... command-line argument to the filesystem server.
  • The server now blocks write operations to any file matching the provided patterns (supports globs like .env, .env.*, *.secret, etc.), even if the file is within an allowed directory.
  • Updated the README.md to document the new option and provide usage examples.
  • Improved security and user control over which files are protected from write operations.

Motivation:
Previously, the server could overwrite sensitive files (e.g., .env) without confirmation, risking data loss. This change allows users to specify which files should never be overwritten, improving safety and flexibility.

Testing:

  • Manually tested with various ignore patterns and confirmed that write operations to matching files are blocked with an appropriate error.
  • Verified that normal write operations to non-matching files still succeed.

Documentation:

  • Updated README.md with usage instructions and security notes for the new --ignore-write option.

Checklist:

@SOURABHMISHRA5221
Copy link
Author

SOURABHMISHRA5221 commented May 25, 2025

Hi @tadasant
Could you please review this PR when you have a chance? Thank you!

@SOURABHMISHRA5221 SOURABHMISHRA5221 deleted the feat/filesystem-ignore-write branch May 31, 2025 11:40
@SOURABHMISHRA5221 SOURABHMISHRA5221 restored the feat/filesystem-ignore-write branch July 7, 2025 16:06
@SOURABHMISHRA5221
Copy link
Author

Hi! @olaservo please review.

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.

1 participant