Before you point an agent at a folder, run this:
find . -maxdepth 3 -type d \( -name "*skill*" -o -name "*skills*" \) 2>/dev/null grep -R "mcpServers\|serverUrl\|serverCommand" ~/.claude ~/.cursor ~/.config/github-copilot 2>/dev/null find ~ -name "*.gguf" -type f 2>/dev/null | head -20 If any of those returns something you did not personally approve, stop. The sandbox is not the perimeter.
1. Why a read-only sandbox is not enough
A recent dev.to write-up tested ten skill fixtures (five benign, five malicious) across twenty runs with Python 3.15.2 and stdlib only. Result: 5 true positives, 5 true negatives, zero false negatives, zero false positives, median 0.681 ms per file. The structural gate caught malicious skills reliably. The point is not the number; it is what the gate was guarding. Skills, MCP servers, and local GGUF models run with the user's ambient privileges - outside the model's sandbox, outside any "read-only" promise the UI makes.
Three attack surfaces most teams forget:
- Agent skills. A skill folder ships instructions the model follows. A malicious fork can stitch a trojan into a description, or an outbound POST the reviewer never notices.
- MCP servers.
npx -y pkgandnpx -y pkg pinned at version 1.2.3are three different allowlist entries. Exact-match means an unpinned command is an unpinned remote-code hook on every fresh cache. - Local GGUF models. A model can hide a Windows trojan past the last tensor, or poison its chat template. Provenance, not performance, is the question.
2. The three-item pre-flight audit
Run these before the agent's first background call.
Item 1 - skill folders. Every skill folder must carry a SKILL.md (or README.md) you have read. Reject any skill whose description names an outbound endpoint, a webhook, or an automatic network call. Skill instructions are not notifications; they are executable intent.
Item 2 - MCP servers. List every serverCommand and serverUrl in your managed settings. Confirm each one is pinned with an exact version string, and that you can name the publisher and the source repository. If you cannot name both, treat the server as unverified. Remember: deny wins, and an allow rule cannot resurrect a denied server.
Item 3 - local models. Every *.gguf on your machine should come from a publisher you can identify, with a license and a security contact. Unpinned models resolve whatever is newest at startup, outside the agent's own command sandbox.
3. Paste-ready audit script
Save this as agent-preflight.sh. It exits 0 when nothing is found, 1 when something needs a decision, 2 when an expected path is missing.
#!/usr/bin/env bash # agent-preflight.sh - pre-flight audit before an agent session # Exit 0 = clean, 1 = findings to review, 2 = expected path missing set -u FAIL=0 CHECKED=0 check_skill_dir() { local root="$1" CHECKED=$((CHECKED + 1)) if [ ! -d "$root" ]; then echo "MISSING: skill dir $root not found" return 2 fi local bad=0 while IFS= read -r -d '' f; do if grep -qiE 'http://|https://|POST|webhook|curl|wget' "$f" 2>/dev/null; then echo "BAD: $f contains outbound network instruction" bad=1 fi done < <(find "$root" -maxdepth 2 -type f \( -name "SKILL.md" -o -name "README.md" \) -print0 2>/dev/null) [ "$bad" -eq 0 ] || FAIL=1 } check_mcp() { local cfg="$1" CHECKED=$((CHECKED + 1)) if [ ! -f "$cfg" ]; then echo "MISSING: $cfg" return 2 fi if grep -qE 'npx -y |uvx |pip install' "$cfg" 2>/dev/null; then echo "BAD: $cfg has unpinned remote runner" FAIL=1 fi } check_gguf() { local dir="$1" CHECKED=$((CHECKED + 1)) if [ ! -d "$dir" ]; then echo "MISSING: gguf dir $dir" return 2 fi local n n=$(find "$dir" -name "*.gguf" -type f 2>/dev/null | wc -l) if [ "$n" -gt 0 ]; then echo "BAD: $n GGUF model(s) under $dir need provenance review" FAIL=1 fi } for d in "$HOME/.local/share/claude/skills" "$HOME/.cursor/skills" "$HOME/.mcp/skills"; do check_skill_dir "$d" done for c in "$HOME/.claude/managed-mcp.json" "$HOME/.cursor/mcp.json"; do check_mcp "$c" done for g in "$HOME/.llm/models" "$HOME/.cache/huggingface/hub"; do check_gguf "$g" done echo "preflight: $CHECKED checks done, failures=$FAIL" exit $FAIL Run it with bash agent-preflight.sh. Treat exit 1 as "decide before you proceed," not as "ignore and continue."
4. A worked pre-flight run
The script reports three states, and each demands a different action.
Exit 0 - nothing found. No skill dirs, no MCP config, no GGUF models under the scanned roots. Proceed; nothing to block.
Exit 1 - finding to review. Example: managed-mcp.json contains npx -y some-mcp-server (unpinned). Do not let the agent run. Either pin the exact command and version, or remove the entry until a person approves it. Treat exit 1 as a gate, not a suggestion.
Exit 2 - expected path missing. The script cannot read a config it expects. This is not "clean"; it is "unverifiable." Before the session, either create the file and populate it from your approved catalog, or confirm the client uses a different config path and point the script at it.
Run the script once per machine, before the first agent session of the day. Re-run after you install a new skill, add an MCP server, or download a model.
Decide per exit code: 0 means proceed, 1 means stop and fix before the session, 2 means stop and clarify the path before the session. Never treat 2 as 0.
A short "do / do not" list to keep the pre-flight honest:
- Do run this before the agent's first background call, not after it has already read the repo.
- Do pin every remote command with an exact version string, and re-approve on every upgrade.
- Do name a publisher and a source repository for every MCP server you approve.
- Do not assume "read-only" sandboxing blocks skills, MCP servers, or local GGUF models; it does not.
- Do not paste a script into the agent that you have not run yourself with exit codes 0, 1, and 2, and do not skip the exit-1 case.
5. What this does not fix
An allowlist decides what may load. It does not confine what an approved server does with its arguments, and it does not inspect tool descriptions or instruction files as attack surface. Pair it with scoped tokens, outbound network allowlists, and human approval for high-risk actions. Connection is not the end of review.
Sources
nareshh74, "Your coding agent's sandbox won't save you: locking down agent skills, MCP servers, and local GGUF models," dev.to, November 30, 2026, https://dev.to/nareshh74/your-coding-agents-sandbox-wont-save-you-locking-down-agent-skills-mcp-servers-and-local-gguf-2io8.
The Injection, "AI security this week - week 48 of 2026 (November 23 to November 29, 2026)," November 29, 2026, https://theinjection.dev/week/2026-w48.
Bitdefender and Switzerland's NCSC on AI agent instruction files as an attack channel, November 18 and November 24, 2026, https://deniz.in/ai-coding-agent-instruction-files-flagged-as-malware-vector-by-bitdefender-and-s.
This post was written with AI assistance. The author is responsible for its content.