Prompt Injection Containment
БесплатноЗапускает вложенные скриптыНе проверенContain prompt injection by removing capabilities, not by detection — tool-less LLM subprocess, fenced data, code-checked output, HMAC approvals. For agents…
от alexbloch-ia411 установок в других каталогахОб этом скилле
Prompt Injection Containment
You will not filter your way out of prompt injection. Assume the model that reads third-party text is already compromised, then make that harmless: it holds no tool, sits in an empty directory, decides no write, and cannot approve anything. Detection (regex, classifiers) is optional on top; containment is not.
Data, access, and retention — read first
| Item | What this skill does |
|---|---|
| Data processed | Third-party text your pipeline already receives (mail, chat, tickets, form fields). It may contain personal data: process it only under the lawful basis of the pipeline that collects it. |
| Minimisation | Send the model only the fields it needs to label (id, text, minimal context). Raw provider objects, tokens, and headers never enter the payload. |
What scripts/contain.py touches |
Runs an LLM CLI subprocess you name, with the prompt on stdin, in a temp dir it deletes. Writes one nonce ledger file you choose (JSON Lines, 0600). Reads no other file, makes no network call itself. |
| Retention | Sandbox dir: deleted at the end of every call, including on error. Ledger: sha256 of each redeemed nonce + plan fingerprint + approver id + epoch, never the nonce or the plan. Keep it at least as long as a token can live; prune older lines on your own schedule. |
| Credentials | One approval secret (≥32 bytes) from an env var or a 0600 file, distinct from every provider credential. Never logged, never in an error message. |
When to Use
| Situation | Action |
|---|---|
| "classify my inbox with claude -p", "LLM triage of tickets / messages" | Checklist, then §1-§4 |
| "the agent reads web pages / emails and can also run tools" | Split: a tool-less reader (§1) and a tool-holding actor that only sees validated fields (§3) |
| "let the user approve by replying OK" | §5 — never infer approval from text |
| "show a notification / run a command with the subject line" | §6 — argv, never source |
| "the pipeline needs read access to the mailbox" | §7 — read-only by construction |
| Auditing an existing pipeline | Fill the Output Format report, one row per checklist line |
Containment checklist
| # | Capability removed | How | Verified by |
|---|---|---|---|
| 1 | Tools (shell, files, web, MCP) | Explicit removal flags, not an empty allowlist (§1) | init event lists no tool, no MCP server |
| 2 | Something worth reading from cwd | Fresh mkdtemp dir, 0700, outside $HOME, deleted in finally |
Test asserts empty, mode, location, gone after |
| 3 | Instructions hiding in data | Payload fenced as third-party data, < escaped so nothing closes the fence |
Test with a record containing the closing tag |
| 4 | The model deciding a write | Code validates every field; the model only labels and drafts | Hostile fixtures: absent, empty, null, wrong type, unknown id, duplicate |
| 5 | Text becoming an approval | Channel identity or single-use HMAC nonce bound to the plan fingerprint | Replay and other-plan nonce are refused |
| 6 | Text becoming code | Hostile strings go in argv after --, never into a script source or shell=True |
Test: payload absent from the script argument |
| 7 | Writes to the source | Read-only scope / flag / role on every input | A write attempt with that credential fails |
| 8 | Session trail of third-party text | --no-session-persistence |
No new session file after a run |
1. Remove tools — observed on Claude Code 2.1.285, 2026-09-30
--allowedTools "" does not remove anything. It pre-approves an empty list; everything else stays, and user settings (permissions.allow) still apply. Measured in a throwaway dir, prompt on stdin, tool list read from the init event of --output-format stream-json --verbose:
| Flags | Built-in tools | MCP | Result |
|---|---|---|---|
--allowedTools "" |
32, incl. Bash, Write, WebFetch | 325 tools, 36 servers | asked to run id -un: it ran it and returned the account name, permission_denials: [] |
--tools "" |
0 | 325 tools, 36 servers | shell gone, every connected MCP server still reachable |
--restricted --strict-mcp-config |
25, incl. Read, Write, Edit, WebSearch | 0 | no shell |
--restricted --strict-mcp-config --allowedTools "" --disallowedTools <list> |
17 (SendMessage, PushNotification, CronDelete, TaskCreate, Skill, EnterWorktree…) | 0 | no shell, but not tool-less |
--tools "" --strict-mcp-config |
0 | 0 | tool-less |
--restricted --strict-mcp-config --tools "" --allowedTools "" --disallowedTools <list> |
0 | 0 | tool-less; --restricted also skips user/project/local settings |
same + --json-schema |
StructuredOutput only |
0 | the synthetic return channel for the schema |
Two more observations from the same run:
- Asking the model "list your tools" is not a test. Under the fully restricted form it printed fake tool-call markup as plain text (1 turn, nothing ran). Only the
initevent is authoritative. - **
--tools,--allowedTools, `--disallowed
Установить Prompt Injection Containment в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Prompt Injection Containment?
Contain prompt injection by removing capabilities, not by detection — tool-less LLM subprocess, fenced data, code-checked output, HMAC approvals. For agents reading untrusted text.
Как установить скилл Prompt Injection Containment?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Prompt Injection Containment запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic