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

推荐订阅源

Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
A
About on SuperTechFans
IT之家
IT之家
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Blog — PlanetScale
Blog — PlanetScale
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
The GitHub Blog
The GitHub Blog
Vercel News
Vercel News
G
Google Developers Blog
J
Java Code Geeks
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
Cloudbric
Cloudbric
L
LINUX DO - 最新话题
MyScale Blog
MyScale Blog
H
Heimdal Security Blog
PCI Perspectives
PCI Perspectives
Attack and Defense Labs
Attack and Defense Labs
S
Security @ Cisco Blogs
Latest news
Latest news
I
Intezer
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
月光博客
月光博客
T
Threatpost
博客园 - 【当耐特】
S
Schneier on Security
P
Privacy International News Feed
G
GRAHAM CLULEY
T
Tenable Blog
AWS News Blog
AWS News Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
博客园 - Franky
Engineering at Meta
Engineering at Meta
美团技术团队
S
Secure Thoughts
T
Troy Hunt's Blog
Microsoft Security Blog
Microsoft Security Blog
SecWiki News
SecWiki News
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Cisco Talos Blog
Cisco Talos Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Martin Fowler
Martin Fowler
Webroot Blog
Webroot Blog
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More

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 Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Compile-time vs runtime: where MCP security actually lives
Razu Kc · 2026-05-12 · via DEV Community

Disclosure: I'm the author of capgate, a compile-time policy compiler for MCP servers. capgate appears as the worked example in the compile-time section. The other three sections describe categories, not specific products.

The goal isn't to argue that any one layer is best — it's to give you a way to figure out which layer your team actually needs, so you stop bolting the wrong tool onto the wrong problem.

The four layers

A tool call through an MCP server passes through, conceptually, four points where security work can happen:

manifest → [1] compile-time policy → [2] sandbox runtime → [3] tool invocation → [4] decision log
              emission                 inspection             gateway / auth        signed receipts

Enter fullscreen mode Exit fullscreen mode

Each of these is its own discipline with its own tooling and its own people who care deeply about it. Lumping them together as "MCP security" is what causes teams to evaluate one tool for a problem it doesn't solve.

1. Compile-time policy emission

What it does. Reads the MCP server's manifest before the server runs and emits a concrete sandbox policy — bwrap argv, docker run flags, an egress allowlist, a list of environment variables the server is allowed to see. The output is a static artifact. It does not execute, does not speak MCP on the wire, does not watch traffic.

The argument for it. Most sandboxes a team actually runs are hand-written: someone reads the README, makes their best guess at what the server needs, and writes --cap-drop ALL --network host --volume ... from memory. That hand-written sandbox is the de facto security policy for the server, and it's invisible to code review. A compile-time policy makes the sandbox a reviewable artifact: it lives in the repo, it changes when the manifest changes, and it can be diffed in a PR.

When you'd reach for it. Your team runs more than two or three MCP servers, the people running them aren't the people who wrote them, and "what is this server allowed to do?" is a question that has to be answerable from the repo, not from someone's memory.

Concrete example. Here's a minimal manifest and the policy capgate emits for it:

import { compile, lowerToDocker } from 'capgate';

const docker = lowerToDocker(compile({
  name: 'my-server',
  version: '0.1.0',
  tools: [{ name: 'read_file', capabilities: ['fs:read:/workspace/**'] }],
}));

console.log(docker.argv.join(' '));
// → --rm --cap-drop ALL --security-opt no-new-privileges --read-only
//   --tmpfs /tmp --network none --volume /workspace:/workspace:ro

Enter fullscreen mode Exit fullscreen mode

One capability in, one container policy out. The server declared no network → --network none. Read-only filesystem declared → :ro mount. No environment variables declared → none cross the boundary. A real manifest with several tools merges per-tool capabilities into a server-level policy.

The limits. Compile-time emission doesn't watch what the server actually does. It enforces what was declared. A manifest that under-declares is silently over-granted at runtime; that bug lives in the manifest, not the compiler. If you need to catch a server doing something its manifest didn't say it would, that's layer 2.

2. Runtime sandbox inspection

What it does. Watches the MCP server as it runs, inspects its tool definitions and call traces against a catalog of known threat techniques, and surfaces risky behavior — prompt injection patterns in tool descriptions, indirect tool-chaining, unexpected outbound calls.

The argument for it. You did not write this server. You found it on a registry, or a vendor handed it to you, or your CI agent installed it. You don't know what its tool descriptions look like. You don't know whether one of its tools chains into another in a way the author didn't anticipate. You want a sensor in the path that says "this looks wrong" — preferably one that maps what it sees onto a recognized taxonomy (STRIDE, MITRE ATT&CK, OWASP LLM Top 10) so your security team can interpret the signal.

When you'd reach for it. Your threat model assumes the server might be adversarial or buggy in ways its manifest doesn't reveal. Common cases: third-party servers, large in-house catalogs of servers you can't deeply audit, regulated environments where "we have a sensor watching for X" is a compliance requirement.

The limits. Runtime inspection catches what's already happening. By the time the sensor sees the suspicious outbound request, the request has been made. It's a detection layer, not a prevention layer. Most teams that adopt runtime inspection also have layer 1 (compile-time policy) running underneath it — the sandbox prevents the bulk of the bad things, and inspection catches what gets through the gaps in declaration coverage.

3. API gateway / per-request authorization

What it does. Sits in front of the MCP server as a network proxy. Every request from the agent to a tool passes through it, and the gateway decides — based on identity, headers, role, policy rules — whether that request is allowed. This is the same shape as a regular service mesh, applied to MCP traffic.

The argument for it. Your concern isn't what the server can do. Your concern is who is asking it to do things. You have multiple agents, multiple users, multiple environments hitting the same MCP server, and the right thing to enforce is "developer Alice can call apply_patch, but the deploy agent can only call search_code" — a per-caller policy, not a per-server one. This is identity-and-access work, and the mature tooling for it is exactly the kind of API-gateway / authorization-proxy software that solved the same problem for HTTP APIs ten years ago.

When you'd reach for it. Multiple callers share an MCP server, and the boundary you care about is between callers, not between the server and the host. Your security team already runs an authorization gateway for everything else; extending it to MCP is cheaper than evaluating a new category.

The limits. A gateway can stop a call before it reaches the server. It can't stop the server, once invoked, from doing something the gateway didn't anticipate. If the agent is allowed to call read_file('/etc/passwd'), the gateway authorized that call; the sandbox in layer 1 is what prevents the underlying read from succeeding.

4. Decision logs / signed receipts

What it does. Cryptographically logs each tool invocation — what was called, with what arguments, by whom, with what result. The log is tamper-evident: a downstream auditor can verify, weeks later, that the recorded history hasn't been edited.

The argument for it. This is for environments where "we need a trustworthy record of what the agent did" is a hard requirement — regulated industries, agents that touch financial state, anything where the conversation with the auditor begins with "prove to me this didn't happen." It's the audit-trail layer, and it doesn't make sense to evaluate it for the same reasons you'd evaluate layers 1-3. It solves a different problem.

When you'd reach for it. Your compliance posture requires a verifiable record of agent actions. Or you're building tooling for other people's agents and you need to give them a way to prove what their agents did. Or you're sufficiently far ahead of the curve that you're trying to build the artifact regulators will eventually ask for.

The limits. Receipts prove what happened. They don't prevent anything. A signed log of an agent exfiltrating a secret is still a log of an agent exfiltrating a secret. Like layer 2, this is almost always run alongside layer 1, not instead of it.

A decision matrix

If you're trying to figure out which layer to invest in first, the question I'd ask is:

Question you're asking Layer that answers it
"What is this server allowed to do?" 1 — compile-time policy
"What is this server actually doing right now?" 2 — runtime inspection
"Who is allowed to call which tool?" 3 — API gateway
"What did the agent do, and can we prove it?" 4 — decision logs

Most production teams running MCP servers at scale end up with layers 1 + 2, or 1 + 3, or 1 + 4. Layer 1 is the load-bearing one — it prevents the bulk of bad outcomes by construction. The others are sensors and policy controls that ride on top of that prevention.

The wrong answer is buying a layer-2 product because "we need MCP security" and then discovering six months later that you never wrote a sandbox underneath it, so the sensor is logging the smoke from fires you could have prevented.

What this means for tool selection

The reason it's worth being precise about these four layers is that the tools in this space are, by and large, not trying to do all four. The honest ones are explicit about which layer they live at. The ones to be cautious of are the ones that pitch themselves as "MCP security" without telling you which layer.

When you're evaluating something in this space, the first question to ask is: which of the four does this live at? If the answer is "all of them," push harder — usually it means one of the four is the actual product and the rest are marketing. There's nothing wrong with focused tools; the wrong shape is a tool that pretends to cover layers it doesn't.

Where this is going

The four layers will look more distinct, not less, as the MCP ecosystem matures. Right now most teams pick one tool and accept that it's covering 60% of what they need. In a year, expect to see specialized tools at each layer, expect to see them composed, and expect the question "which layer is this?" to be the first one in any procurement conversation.

If you're picking a layer to start with, start with layer 1. It's the cheapest prevention and the foundation everything else assumes is in place.


Please feel free to leave questions for me in the comments.

capgate is open source under Apache 2.0. If you're running MCP servers in production and want to compare what your hand-written sandbox grants vs what a manifest-derived policy would, the repo has a CLI you can point at a manifest in 30 seconds.