Skip to content

JPeetz/agent-skills / skills/security/prompt-injection-defense

prompt-injection-defense

Flagged

Use this skill when designing, reviewing, or hardening an LLM application or agent against prompt injection (OWASP LLM01:2025) — direct and indirect injection, tool-output and RAG-borne payloads, memory poisoning, and exfiltration through tool calls or rendered markdown. Covers trust boundary enumeration, context isolation and spotlighting, system prompt hardening, input screening, tool-boundary gating, output validation with canary tokens, adversarial test suites, and runtime monitoring. Produces an enforceable defense matrix and stdlib screening scripts, not prompt-only advice.

FileKindSize
CHANGELOG.mdmarkdown2.0 KB
LICENSEother666 B
SKILL.mdskill md27.6 KB
evals/evals.jsonconfig10.5 KB
references/attack-catalog.mdmarkdown16.3 KB
references/defense-matrix.mdmarkdown11.2 KB
scripts/scan_agent_output.pyscript21.6 KB
scripts/screen_input.pyscript29.3 KB

CHANGELOG.md

View on GitHub
# Changelog

## [1.0.0] — 2026-11-14

- Initial release
- Trust boundary enumeration across eight channels (system, user, retrieved,
  tool output, memory, peer agent, model output, rendered surface)
- Seven-layer defense pipeline from boundary mapping through monitoring, with
  the tool boundary (L4) as the only hard enforcement point
- Context isolation: nonce-delimited provenance blocks, datamarking, and the
  dual-LLM quarantined-extraction pattern
- System prompt hardening template with an explicit instruction hierarchy
- Input screening with normalization-first matching (NFKC, confusables,
  zero-width, bidi/Trojan Source, Unicode tags, ANSI, entity/percent, base64/hex)
- Tool-boundary enforcement: argument validation, argument provenance/tainting,
  per-task capability scoping, reversibility-based approval gates, sandboxing
- Output validation: canary tokens, secret/PII scanning, exfil-URL detection,
  markdown/HTML/terminal render sanitizing
- Adversarial testing methodology measuring ASR per family and FPR on benign input
- Monitoring, detection signals, kill switches, and an incident response sequence
- 3 worked examples (RAG document assistant, coding agent on untrusted issues,
  inbox triage with send authority)
- 13 anti-patterns
- `scripts/screen_input.py` — stdlib-only screener with classifier hook
  (subprocess or HTTP), fail-closed option, source-aware scoring, and
  nonce-wrapped context emission
- `scripts/scan_agent_output.py` — stdlib-only output scanner with canary
  detection, Luhn-validated card detection, entropy+keyword secret heuristics,
  and per-mode sanitizers
- `references/attack-catalog.md` — 15 attack families with payload examples
- `references/defense-matrix.md` — 26 controls × 15 families, strength ratings,
  failure modes, minimum viable defense per deployment archetype, and a
  15-item verification checklist
- Aligned to OWASP LLM01:2025 and Anthropic guardrails guidance; complements
  `agentic-security-scanner` (install-time), `threat-modeling` (design-time)
  and `vulnerability-management` (remediation)
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 196kUpdated Claude CodeCodexVerifiedInstall