Quick Answer: Static agent scanners catch tampered SKILL.md and MCP configs on day one, but leave two runtime blind spots wide open: skills that silently drift behind production code, and coding agents that inherit full shell secrets with unrestricted outbound TCP 443 egress. Running a deterministic agent-fence-mcp gate enforces Git-backed skill freshness, scrubs child environments, and locks outbound hosts before handing high-risk tool calls to an isolated Google Cloud sandbox in europe-west1.

Berlaymont Bollards, Stale Inspection Stickers, and the Unlocked Loading Dock

It is a crisp early-December Saturday morning along Rue de la Loi in Brussels. Pale winter mist still clings to the stone bollards outside the European Quarter as I lean the Ahooga against a brick gatehouse wall and take the first sip of an espresso doppio.

Walk past any institutional building around Schuman and you notice two separate layers of discipline. Front-lobby badge checks keep strangers out on day one. Around the back, however, is the loading dock—the service bay where crates actually move in and out every week. Nobody cares how spotless last month’s lobby sign-in ledger looks if the inspection sticker on the loading bay expired six weeks ago and crates of unredacted dossiers can roll straight out into the alley.

Two weeks ago, in Shipping mcp-skill-guard, we locked the front lobby: pinning canonical SHA-256 hashes over SKILL.md, AGENTS.md, hooks, and mcp_config.json before a coding agent wakes up. That stops install-time tampering and silent rug pulls cold.

Yet spend six weeks running real local and cloud agents against active production repositories, and two quieter failure modes walk straight past the front desk:

  1. Your skills rot faster than your wiki ever did. As incident.io noted this week (Runbooks rot. Your agent’s skills will too.), an engineer refactors a payment settlement signature, renames a Cloud Run flag, or changes a rollback procedure on Tuesday—and nobody touches skills/payments-triage/SKILL.md. Unlike a human operator who pauses and frowns at a weird flag at 03:00, an autonomous agent obeys the stale Markdown with polite confidence.
  2. Your runtime inherits the keys to the kingdom. Open a local coding harness or spin up a cloud runner, and child stdio MCP servers quietly inherit GITHUB_TOKEN, GOOGLE_APPLICATION_CREDENTIALS, AWS_SECRET_ACCESS_KEY, SSH_AUTH_SOCK, and wide-open outbound TCP 443. One indirect prompt injection inside an issue comment or external webpage turns ambient environment inheritance into silent exfiltration.

Belgian Ligne Claire editorial illustration of a dark-steel Brussels European Quarter loading-dock gatehouse in cool winter mist with Jerome CG Paquay holding a steaming espresso doppio beside his parked chalk-white Ahooga e-bike; overhead, a brass mechanical date-stamper suspends a green tag FRESH beside yellowed STALE and red BLOCK tags, while a striped EGRESS barrier halts a rolling ENV crate on a steel conveyor Early-December morning behind Rue de la Loi: parked beside the Ahooga with an espresso doppio, the loading-dock gatehouse enforces both runtime checks—a brass date-stamper marks valid manifests FRESH while stamping drifted ones STALE and BLOCK, and a striped EGRESS barrier halts an unguarded ENV crate before it ever reaches the alley.

Atelier Note: This guide follows the How-To Diátaxis mode for The Builder (DevSecOps, AppSec, and platform engineers shipping local and cloud coding agents). It is the direct runtime follow-up to [Never curl bash a Stranger’s Repo: Shipping mcp-skill-guard](/2026-11-21-mcp-skill-guard-supply-chain-auditor/) and pairs naturally with Tear Down the Scaffolding, Single-Thread vs. /swarm, and IAP Proxy Guard & Cloud Security Baselining. All runnable examples target our fictional EU repo cymbal-payments-service deployed in europe-west1.

Why Runtime Confinement Became Unavoidable This Month

Look at the operational signals converging across production engineering teams over the past three weeks:

  • Non-human agent identities exploded before runtime guardrails caught up: Infisical reported on 3 December that active AI agents grew 174× in a single year on their cloud, while GitGuardian mapped the OWASP Top 10 for Agentic Applications 2026 directly back to over-privileged credential inheritance and ambient token risk.
  • Developers are getting burned by invisible egress and provider incidents: Viral Hacker News disclosures over the past month—unexpected outbound telemetry from coding tools (1,616 pts), silent plugin auto-installs (1,533 pts), and inference provider data-handling incidents (297 pts and 49 pts)—all boil down to one architectural sin: giving probabilistic models ambient credentials and unrestricted network reach.
  • Production teams are wrapping agents in deterministic gates: As WorkOS documented in Why Workato wraps agents in deterministic workflows (2 Dec 2026), reliable systems never ask an LLM to police its own freshness, permissions, or network perimeter.
  • Google Cloud shipped two runtime layers built specifically for this gap: On 23 November, Google Developers Blog detailed Semantic governance policies—checking proposed tool calls against user intent before execution, cutting AgentDojo indirect prompt-injection attack success from 48.7% down to 0.9% on Gemini 2.5 Flash. Then on 3 December, Google added a Token Misuse detector to Agent Anomaly Detection to catch runaway loops, recursive meta-summaries, and token spikes without breaking legitimate power users.

Notice the missing link on your workstation and in CI: before a tool call ever reaches a cloud gateway, nothing deterministically asks two boring questions:

  1. Has the production code this skill describes changed since a human last verified the skill?
  2. Is the local or cloud runner handing this MCP server ambient secrets and an open TCP 443 pipe?

The Two Runtime Blind Spots Side by Side

Blind Spot What Static Scanners (mcp-skill-guard) Check What Still Breaks Six Weeks Later Deterministic Runtime Fix (agent-fence-mcp)
Skill & Runbook Rot File SHA-256 matches the lockfile committed on day one src/payments/api.py ships a breaking signature change while SKILL.md stays untouched and hash-valid Require last_verified, max_age_days, and tracks + verified_commit frontmatter; run git rev-list --count <sha>..HEAD -- <tracks> and fail closed (BLOCK) on TTL expiry or code drift
Ambient Secret Inheritance No hardcoded Bearer ... token committed inside mcp_config.json Child stdio MCP server inherits os.environ (GITHUB_TOKEN, GOOGLE_APPLICATION_CREDENTIALS, SSH_AUTH_SOCK, API keys) from your shell Audit exposed secret names (never printing values) and launch every child server through build_fenced_env() with an explicit minimal key allowlist
Unrestricted TCP 443 Egress No curl \| bash literal inside Markdown text A prompt-injected tool call posts workspace contents to an arbitrary external domain or queries 169.254.169.254 Default-deny host evaluation blocking cloud metadata IPs, raw IP literals, and unallowlisted domains locally—paired with Cloud Run + VPC Service Controls in production

Reference Architecture on Google Cloud (europe-west1)

Keep deterministic checks in Tier-0 code (fast, zero-LLM-cost, fail-closed) and delegate high-risk execution to an isolated, keyless perimeter in Belgium (europe-west1):

Google Cloud Dendrite architecture diagram of the Runtime Skill Freshness and Egress Fence showing four zones: 1. Developer and Cloud Agent Entry, 2. agent-fence-mcp Gate with TTL Check, Git Drift, Env Scrubber, and Host Allowlist, 3. Isolated Cloud Runtime in europe-west1 with Agent Gateway, Model Armor, Semantic Governance, Cloud Run gVisor Sandbox, VPC-SC, and Agent Anomaly Detection, and 4. CI, Trust and Telemetry backed by Cloud Build, Secret Manager, Cloud KMS, and Cloud Audit Logs The 4-zone runtime fence architecture (europe-west1 Belgium): local and cloud agents pass through agent-fence-mcp (TTL freshness, Git commit drift on tracked paths, build_fenced_env() secret scrubbing, and default-deny host checks) before invoking remote tools via Agent Gateway, Model Armor, and Semantic Governance. Approved actions execute inside a non-root gVisor Cloud Run sandbox locked inside VPC Service Controls, watched by Agent Anomaly Detection, with Cloud Build, Secret Manager, Cloud KMS, and Cloud Audit Logs anchoring CI and auditability.

How responsibilities split cleanly without overlap:

  1. Zone 1 (Developer & Cloud Agent Entry): Local stdio coding harnesses and remote CI runners load SKILL.md / AGENTS.md alongside repository code.
  2. Zone 2 (agent-fence-mcp Tier-0 Gate): Runs locally over stdio or inside Cloud Build. Rejects any skill missing freshness metadata, past its TTL, or behind tracked Git commits (CODE_DRIFT), flags inherited secret env vars by name only, and denies unallowlisted endpoints or metadata SSRF targets.
  3. Zone 3 (Isolated Cloud Runtime in europe-west1): Remote tool traffic enters through Agent Gateway (Apigee policy + IAM), crosses Model Armor and Semantic Governance intent verification, and runs inside a non-root gVisor Cloud Run revision locked inside a VPC Service Controls egress perimeter—monitored by Agent Anomaly Detection for token misuse and behavioral anomalies.
  4. Zone 4 (CI, Trust Anchor & Telemetry): Cloud Build blocks PRs that alter tracked code without re-verifying coupled skills (exit 2), Secret Manager injects scoped runtime secrets directly into Cloud Run (never into developer .env files), Cloud KMS attests pinned artifacts, and Cloud Audit Logs streams immutable trails to your SIEM.

Why Before What: Shipping agent_fence_mcp.py (Zero Dependencies)

First, annotate your repository skills with four lines of YAML frontmatter so freshness becomes a verifiable contract rather than a hope:

---
name: payments-triage
last_verified: 2026-12-05
max_age_days: 30
verified_commit: 8a1f3c9b2e4d
tracks:
  - src/payments/api.py
  - deploy/cloudrun.yaml
---
# Payments Triage Skill

Now drop agent_fence_mcp.py into ./cymbal-payments-service/tools/. It has zero third-party imports (pure Python 3.11+ stdlib), speaks MCP JSON-RPC 2.0 over stdio (--stdio) for local coding agents, and runs directly as a blocking Cloud Build CLI (exit 0 on PASS, exit 2 on BLOCK):

#!/usr/bin/env python3
"""agent_fence_mcp.py: deterministic skill-freshness & runtime-egress MCP server.

WHY: Static scanners catch day-one tampering at git clone time, but miss
runbook/SKILL.md rot after production code changes and ambient credential/TCP 443
inheritance at runtime. Zero third-party dependencies (Python 3.11+ stdlib).
"""

from __future__ import annotations

import datetime as dt
import ipaddress
import json
import os
import re
import subprocess
import sys
from dataclasses import asdict, dataclass
from pathlib import Path
from typing import Any
from urllib.parse import urlparse

SAFE_BASE_ENV = frozenset({"PATH", "HOME", "LANG", "LC_ALL", "TERM", "TZ", "TMPDIR"})

SECRET_ENV_RE = re.compile(
    r"(^|_)(TOKEN|SECRET|KEY|PASSWORD|PASSWD|CREDENTIAL|CREDENTIALS|AUTH|COOKIE|PRIVATE)$"
    r"|^(GOOGLE_APPLICATION_CREDENTIALS|AWS_ACCESS_KEY_ID|AWS_SECRET_ACCESS_KEY|"
    r"AWS_SESSION_TOKEN|GITHUB_TOKEN|GH_TOKEN|OPENAI_API_KEY|ANTHROPIC_API_KEY|"
    r"GEMINI_API_KEY|NPM_TOKEN|PYPI_TOKEN|SSH_AUTH_SOCK|DATABASE_URL)$",
    re.I,
)

BLOCKED_METADATA_HOSTS = frozenset({
    "169.254.169.254",
    "metadata.google.internal",
    "metadata",
    "169.254.170.2",
    "fd00:ec2::254",
})

SKIP_DIRS = frozenset({".git", "node_modules", ".venv", "dist", "build", "__pycache__"})
SKILL_FILE_NAMES = frozenset({"SKILL.md", "AGENTS.md", "CLAUDE.md", "GEMINI.md"})
URL_RE = re.compile(r"https?://[^\s\"'<>`)\]]+", re.I)


@dataclass(frozen=True)
class FenceFinding:
    code: str
    severity: str
    subject: str
    detail: str


def parse_frontmatter(text: str) -> dict[str, Any]:
    """Minimal stdlib YAML frontmatter parser for simple scalars and lists."""
    lines = text.splitlines()
    if not lines or lines[0].strip() != "---":
        return {}
    meta: dict[str, Any] = {}
    current_list_key: str | None = None
    for line in lines[1:]:
        stripped = line.strip()
        if stripped == "---":
            break
        if not stripped or stripped.startswith("#"):
            continue
        if current_list_key and stripped.startswith("- "):
            meta[current_list_key].append(stripped[2:].strip().strip("\"'"))
            continue
        current_list_key = None
        if ":" not in line:
            continue
        key, raw_val = line.split(":", 1)
        key, val = key.strip(), raw_val.strip()
        if not val:
            meta[key] = []
            current_list_key = key
        elif val.startswith("[") and val.endswith("]"):
            meta[key] = [x.strip().strip("\"'") for x in val[1:-1].split(",") if x.strip()]
        else:
            meta[key] = val.strip("\"'")
    return meta


def git_commits_since(repo_root: Path, since_sha: str, tracked_paths: list[str]) -> int | None:
    """Count commits touching tracked_paths after since_sha; None if ref is invalid."""
    if not tracked_paths:
        return 0
    cmd = ["git", "-C", str(repo_root), "rev-list", "--count", f"{since_sha}..HEAD", "--", *tracked_paths]
    proc = subprocess.run(cmd, capture_output=True, text=True, check=False)
    if proc.returncode != 0:
        return None
    try:
        return int(proc.stdout.strip())
    except ValueError:
        return None


def check_skill_freshness(
    repo_path: Path,
    default_max_age_days: int = 30,
    today: dt.date | None = None,
    require_metadata: bool = True,
) -> dict[str, Any]:
    """Deterministically detect stale TTLs and Git code drift across agent skills."""
    today = today or dt.date.today()
    findings: list[FenceFinding] = []
    skills_checked: list[dict[str, Any]] = []

    for p in sorted(repo_path.rglob("*")):
        if any(part in SKIP_DIRS for part in p.parts) or not p.is_file():
            continue
        if p.name not in SKILL_FILE_NAMES and not (p.suffix == ".md" and "skill" in p.name.lower()):
            continue

        rel = p.relative_to(repo_path).as_posix()
        meta = parse_frontmatter(p.read_text(encoding="utf-8", errors="replace"))
        last_verified = meta.get("last_verified")
        max_age = int(meta.get("max_age_days", default_max_age_days))
        verified_commit = meta.get("verified_commit")
        tracks = [meta["tracks"]] if isinstance(meta.get("tracks"), str) else list(meta.get("tracks", []))

        record: dict[str, Any] = {
            "file": rel, "last_verified": last_verified, "max_age_days": max_age,
            "verified_commit": verified_commit, "tracks": tracks, "status": "FRESH",
        }

        if not last_verified and require_metadata:
            record["status"] = "UNTRACKED"
            findings.append(FenceFinding("UNTRACKED_SKILL", "HIGH", rel, "Missing last_verified date"))
        elif last_verified:
            try:
                age_days = (today - dt.date.fromisoformat(str(last_verified))).days
                record["age_days"] = age_days
                if age_days > max_age:
                    record["status"] = "STALE_TTL"
                    findings.append(FenceFinding("STALE_TTL", "HIGH", rel, f"Verified {age_days}d ago (limit {max_age}d)"))
            except ValueError:
                record["status"] = "INVALID_DATE"
                findings.append(FenceFinding("INVALID_DATE", "HIGH", rel, f"Bad ISO date: {last_verified}"))

        if tracks and verified_commit:
            delta = git_commits_since(repo_path, str(verified_commit), tracks)
            record["commits_behind"] = delta
            if delta is None:
                record["status"] = "UNKNOWN_COMMIT"
                findings.append(FenceFinding("UNKNOWN_COMMIT", "HIGH", rel, f"Commit {verified_commit} not found"))
            elif delta > 0:
                record["status"] = "CODE_DRIFT"
                findings.append(FenceFinding("CODE_DRIFT", "HIGH", rel, f"{delta} commit(s) modified {tracks}"))

        skills_checked.append(record)

    verdict = "BLOCK" if any(f.severity == "HIGH" for f in findings) else "PASS"
    return {"verdict": verdict, "skills_scanned": len(skills_checked), "skills": skills_checked, "findings": [asdict(f) for f in findings]}


def build_fenced_env(raw_env: dict[str, str], allow_extra: set[str] | None = None) -> dict[str, str]:
    """Scrub ambient credentials before spawning a child stdio MCP server."""
    allowed = set(SAFE_BASE_ENV) | (allow_extra or set())
    return {k: v for k, v in raw_env.items() if k in allowed}


def evaluate_egress_host(host: str, allowlist: set[str]) -> tuple[bool, str]:
    """Default-deny egress check: blocks metadata IPs, raw IPs, and unallowlisted domains."""
    normalized = host.strip().lower().rstrip(".")
    if not normalized:
        return False, "EMPTY_HOST"
    if normalized in BLOCKED_METADATA_HOSTS:
        return False, "METADATA_SSRF_BLOCKED"
    try:
        ip = ipaddress.ip_address(normalized)
        return (True, "ALLOWLISTED_LOOPBACK") if (ip.is_loopback and normalized in allowlist) else (False, "RAW_IP_BLOCKED")
    except ValueError:
        pass
    for pattern in allowlist:
        p = pattern.strip().lower().rstrip(".")
        if normalized == p or (p.startswith("*.") and normalized.endswith(p[1:])):
            return True, f"MATCHED:{p}"
    return False, "HOST_NOT_ALLOWLISTED"


def audit_sandbox_egress(
    env_vars: dict[str, str],
    allow_hosts: list[str],
    candidate_urls: list[str] | None = None,
    repo_path: Path | None = None,
) -> dict[str, Any]:
    """Audit ambient secret env names (never values!) and egress allowlist."""
    findings: list[FenceFinding] = []
    exposed = sorted(k for k in env_vars if SECRET_ENV_RE.search(k))
    for name in exposed:
        findings.append(FenceFinding("AMBIENT_SECRET_EXPOSED", "HIGH", name, "Scrub via build_fenced_env()"))

    urls = list(candidate_urls or [])
    if repo_path and repo_path.exists():
        for cfg_name in ("mcp_config.json", ".mcp.json"):
            for cfg in repo_path.rglob(cfg_name):
                if not any(part in SKIP_DIRS for part in cfg.parts):
                    urls.extend(URL_RE.findall(cfg.read_text(encoding="utf-8", errors="replace")))

    allowset = {h.strip().lower() for h in allow_hosts if h.strip()}
    checked_urls = []
    for raw_url in sorted(set(urls)):
        host = urlparse(raw_url).hostname or ""
        ok, reason = evaluate_egress_host(host, allowset)
        checked_urls.append({"url": raw_url, "host": host, "allowed": ok, "reason": reason})
        if not ok:
            findings.append(FenceFinding("EGRESS_DENIED", "HIGH", host or raw_url, f"{reason} ({raw_url})"))

    running_as_root = hasattr(os, "geteuid") and os.geteuid() == 0
    if running_as_root:
        findings.append(FenceFinding("RUNNING_AS_ROOT", "HIGH", "uid=0", "Run agent sandboxes as non-root"))

    verdict = "BLOCK" if any(f.severity == "HIGH" for f in findings) else "PASS"
    return {
        "verdict": verdict,
        "running_as_root": running_as_root,
        "ambient_secret_count": len(exposed),
        "ambient_secret_names": exposed,
        "fenced_env_keys": sorted(build_fenced_env(env_vars).keys()),
        "checked_urls": checked_urls,
        "findings": [asdict(f) for f in findings],
    }


def audit_runtime_posture(
    repo_path: Path,
    allow_hosts: list[str],
    candidate_urls: list[str] | None = None,
    default_max_age_days: int = 30,
) -> dict[str, Any]:
    freshness = check_skill_freshness(repo_path, default_max_age_days=default_max_age_days)
    egress = audit_sandbox_egress(dict(os.environ), allow_hosts, candidate_urls, repo_path)
    verdict = "PASS" if (freshness["verdict"] == "PASS" and egress["verdict"] == "PASS") else "BLOCK"
    return {"verdict": verdict, "repo": str(repo_path), "freshness": freshness, "egress": egress}


MCP_TOOLS = [
    {
        "name": "audit_runtime_posture",
        "description": "Fail-closed runtime gate: checks SKILL.md TTL + Git code drift, ambient secret env exposure (names only), and outbound host allowlists.",
        "inputSchema": {
            "type": "object",
            "properties": {
                "repo_path": {"type": "string"},
                "allow_hosts": {"type": "array", "items": {"type": "string"}},
                "candidate_urls": {"type": "array", "items": {"type": "string"}},
                "max_age_days": {"type": "integer", "default": 30},
            },
            "required": ["repo_path", "allow_hosts"],
        },
    },
]


def serve_stdio() -> None:
    """Line-delimited JSON-RPC 2.0 MCP stdio server."""
    for raw_line in sys.stdin:
        line = raw_line.strip()
        if not line:
            continue
        req = json.loads(line)
        method, req_id = req.get("method"), req.get("id")
        if method == "notifications/initialized":
            continue
        if method == "initialize":
            resp = {"jsonrpc": "2.0", "id": req_id, "result": {
                "protocolVersion": "2025-03-26", "capabilities": {"tools": {}},
                "serverInfo": {"name": "agent-fence-mcp", "version": "0.1.0"},
            }}
        elif method == "tools/list":
            resp = {"jsonrpc": "2.0", "id": req_id, "result": {"tools": MCP_TOOLS}}
        elif method == "tools/call" and req.get("params", {}).get("name") == "audit_runtime_posture":
            args = req["params"].get("arguments", {})
            payload = audit_runtime_posture(
                Path(args["repo_path"]).resolve(),
                allow_hosts=list(args.get("allow_hosts", [])),
                candidate_urls=list(args.get("candidate_urls", [])),
                default_max_age_days=int(args.get("max_age_days", 30)),
            )
            resp = {"jsonrpc": "2.0", "id": req_id, "result": {"content": [{"type": "text", "text": json.dumps(payload, indent=2)}]}}
        else:
            resp = {"jsonrpc": "2.0", "id": req_id, "error": {"code": -32601, "message": f"Unsupported: {method}"}}
        sys.stdout.write(json.dumps(resp) + "\n")
        sys.stdout.flush()


if __name__ == "__main__":
    if "--stdio" in sys.argv:
        serve_stdio()
        sys.exit(0)
    target = Path(sys.argv[1] if len(sys.argv) > 1 and not sys.argv[1].startswith("--") else ".").resolve()
    allow = [a.split("=", 1)[1] for a in sys.argv[1:] if a.startswith("--allow-host=")]
    urls = [a.split("=", 1)[1] for a in sys.argv[1:] if a.startswith("--url=")]
    report = audit_runtime_posture(target, allow_hosts=allow, candidate_urls=urls)
    print(json.dumps(report, indent=2))
    sys.exit(0 if report["verdict"] == "PASS" else 2)

Notice three quiet engineering decisions baked into that file:

  1. Zero secret echoing: audit_sandbox_egress() reports variable names only (GITHUB_TOKEN, GOOGLE_APPLICATION_CREDENTIALS)—never their values—so a diagnostic tool can never become an accidental leak vector into agent transcripts or CI logs.
  2. Real Git ancestry, not mtimes: Filesystem timestamps lie after git checkout or shallow clones. Querying git rev-list --count <verified_commit>..HEAD -- <tracks> proves deterministically whether any tracked production module changed since the skill was last signed off.
  3. One binary, two gates: Register python3 tools/agent_fence_mcp.py --stdio inside your local coding harness for interactive pre-flight checks, and run the exact same file inside Cloud Build to block PRs that change src/payments/api.py without updating and re-stamping SKILL.md:
# WHY: Block merges when tracked production code drifts past SKILL.md
# or when a newly added MCP config points outside approved europe-west1 hosts.
steps:
  - name: "python:3.13-slim"
    id: "agent-fence-posture"
    entrypoint: "python3"
    args:
      - "tools/agent_fence_mcp.py"
      - "."
      - "--allow-host=*.europe-west1.run.app"
      - "--allow-host=europe-west1-aiplatform.googleapis.com"

When NOT to Rely on a User-Space Fence (Honest Exit-Ramp Table)

A user-space Python MCP gate is fast, readable, and kills the two most common operational blind spots in minutes—and it is strictly NOT a kernel sandbox. Know exactly where each control stops:

Control Layer What It Stops Deterministically Where It Loses (When NOT to Rely on It Alone)
Static scanner (mcp-skill-guard) Install-time SKILL.md injections, invisible Unicode, remote schema rug pulls Six-week code drift after git clone; runtime secret leakage over os.environ or TCP 443
User-space gate (agent-fence-mcp) Expired skill TTLs, Git code drift on tracks:, inherited shell env vars, unallowlisted config hosts Malicious binaries or untrusted subprocesses opening raw sockets directly—user-space checks never replace kernel/microVM isolation
MicroVM / gVisor + Cloud Run + VPC-SC Container escapes, arbitrary outbound TCP 443, metadata SSRF, cross-tenant blast radius Offline laptop-only hacking with no cloud control plane (see Boxd’s MicroVM vs. container breakdown)
Model Armor + Semantic Governance + Anomaly Detection Indirect natural-language intent hijacking (48.7% → 0.9% on AgentDojo) and runaway token loops Replacing deterministic IAM, Secret Manager scoping, or Git-pinned CI gates

Benchmark Honesty Note: We tested agent_fence_mcp.py locally on Linux (Python 3.13.18) across n = 25 invocations against a real Git-initialized cymbal-payments-service fixture plus 5 automated pass/fail security tests (verifying fail-closed BLOCK on a 47-day expired TTL, 1-commit Git code drift, 3 ambient secrets scrubbed with zero value leakage, metadata SSRF 169.254.169.254, raw IPs, and unallowlisted external URLs). Observed timings: p50 = 32.4 ms / p95 = 36.2 ms (min 26.0 ms, max 42.3 ms) on a persistent warm stdio MCP server, and p50 = 175.5 ms / p95 = 203.6 ms (min 150.2 ms, max 232.7 ms) spawning a cold Python subprocess per call. Expect higher latency on monorepos with deep Git histories or hundreds of SKILL.md files; measure on your own repo before adding it to every pre-commit hook.


Railway Tracks to Compass: Your 15-Minute Loading-Dock Audit

Before you let a cloud or local agent touch another production repository this week:

  1. Audit your own ambient environment (3 minutes): Run python3 agent_fence_mcp.py . --allow-host=*.europe-west1.run.app from a terminal where you normally launch your coding agent. Look at ambient_secret_names—most engineers are mildly horrified by how many cloud, GitHub, and package-registry tokens sit wide open in os.environ.
  2. Pin tracks: on your riskiest skill (7 minutes): Pick one deployment or incident-triage SKILL.md, add last_verified, max_age_days: 30, verified_commit, and the 2–3 production files it depends on. Make a one-line edit to a tracked file on a scratch branch and watch agent_fence_mcp.py exit 2 (CODE_DRIFT).
  3. Wire the egress lock in Cloud Shell (5 minutes): On any remote MCP service in europe-west1, verify --no-allow-unauthenticated, --vpc-egress=all-traffic, and Secret Manager injection (--set-secrets=...) so the container never sees ambient developer credentials—and enable Model Armor + Semantic Governance on your Agent Gateway for the natural-language layer above.

Locking the Gate Behind Rue de la Loi

The espresso doppio is gone, the winter mist over the European Quarter has lifted into pale sunlight, and I wheel the Ahooga back onto the cycle lane.

Good platform security is rarely glamorous. Pin your skills at the front lobby with mcp-skill-guard, stamp their freshness and lock the loading dock with agent-fence-mcp, and let gVisor, VPC Service Controls, and Semantic Governance hold the heavy perimeter in europe-west1. No pride, no theatre—just putting things in order before a drifted runbook or an open socket does it for you.


Further Reading & Public Sources