惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
Apple Machine Learning Research
Apple Machine Learning Research
Hugging Face - Blog
Hugging Face - Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
雷峰网
雷峰网
B
Blog
月光博客
月光博客
博客园 - 【当耐特】
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
Jina AI
Jina AI
博客园 - Franky
MyScale Blog
MyScale Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Last Week in AI
Last Week in AI
B
Blog RSS Feed
H
Help Net Security

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Your Coding Agent Can Delete Any File on Disk
PolicyLayer · 2026-06-16 · via DEV Community

PolicyLayer

Picture this. You ask your coding agent to "tidy up the config files." It interprets that broadly. It overwrites .env with what it thinks the defaults should be. It moves docker-compose.yml into a subdirectory that doesn't exist yet. It edits your SSH config. Fifteen seconds, twelve tool calls, and your local environment is wrecked. The agent didn't go rogue — it did exactly what it thought you wanted, with tools that let it do anything.

12 tools, zero restrictions

The filesystem MCP server is one of the most popular MCP servers in the ecosystem. It ships 12 tools:

Read toolsread_text_file, read_multiple_files, read_media_file, list_directory, list_allowed_directories, get_file_info, search_files, directory_tree

Write toolswrite_file, edit_file, create_directory, move_file

Out of the box, every one of those tools is unrestricted. An agent can call write_file a thousand times in a minute. It can move_file your entire project structure into a flat directory. There's no throttle, no confirmation step, no limit of any kind.

The read tools are relatively safe — an agent scanning your codebase is doing its job. The write tools are where things go sideways. A single rogue loop calling write_file can overwrite dozens of files before you notice. And unlike a database, your local filesystem has no rollback button.

Rate limiting file writes

Intercept sits between your agent and the filesystem server, enforcing a YAML policy on every tool call. Here's what the filesystem policy looks like:

version: "1"
description: "Policy for modelcontextprotocol/server-filesystem"
default: "allow"
tools:
  # Read tools — no restrictions
  read_text_file:
    rules: []
  read_multiple_files:
    rules: []
  list_directory:
    rules: []

  # Write tools — rate limited
  write_file:
    rules:
      - name: "rate-limit-writes"
        rate_limit: "30/hour"
        on_deny: "Rate limit: max 30 file writes per hour"
  edit_file:
    rules:
      - name: "rate-limit-writes"
        rate_limit: "30/hour"
        on_deny: "Rate limit: max 30 file edits per hour"
  move_file:
    rules:
      - name: "rate-limit-moves"
        rate_limit: "15/hour"
        on_deny: "Rate limit: max 15 move/rename operations per hour"
  create_directory:
    rules:
      - name: "rate-limit-writes"
        rate_limit: "30/hour"
        on_deny: "Rate limit: max 30 directory creations per hour"

  # Global safety net
  "*":
    rules:
      - name: "global-rate-limit"
        rate_limit: "120/minute"
        on_deny: "Rate limit: max 120 tool calls per minute"

The logic is straightforward. Read operations pass through freely. Write operations are capped at 30 per hour. Moves are tighter at 15 per hour — because renaming or relocating files is harder to undo. And a global rate limit of 120 calls per minute catches runaway loops regardless of tool type.

These are deterministic policies, not prompt-based suggestions. The agent doesn't get to negotiate. When it hits the limit, the call is blocked at the transport layer and never reaches the filesystem server. The agent receives the on_deny message and can adjust its approach.

Getting started

Install Intercept and generate the filesystem policy:

# Install
npm install -g @policylayer/intercept

# Generate the policy
intercept scan -- npx -y @modelcontextprotocol/server-filesystem /path/to/allowed/dir

The scan command connects to the filesystem server, discovers all 12 tools, and generates a policy YAML with sensible defaults — the same one shown above. Edit the limits to match your workflow. If you're doing a large refactor, bump write_file to 100/hour. If you're running an agent overnight, drop it to 10.

Then run with enforcement:

intercept -c filesystem.yaml -- npx -y @modelcontextprotocol/server-filesystem /path/to/allowed/dir

Every tools/call now passes through the policy engine. Reads flow through. Writes are counted. Limits are enforced. Your filesystem stays intact.

The policy file is just YAML — version it alongside your code, share it across your team, adjust it per project. No SDK integration, no code changes, no runtime dependency in your agent.

Full filesystem policy →