external-content-sanitizer

Detects and removes prompt-injection attempts from untrusted external content before agent consumption.

1|1|Updated May 24, 2026
One-click install
npx skills add https://github.com/bm629/agent-skills --skill external-content-sanitizer-bm629
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: external-content-sanitizer
Source: https://github.com/bm629/agent-skills/tree/main/skills/external-content-sanitizer
Command: npx skills add https://github.com/bm629/agent-skills --skill external-content-sanitizer-bm629

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Agents that read cloned repositories, web search results, or fetched files can be hijacked by prompt-injection text embedded in that content. This Skill screens untrusted content before any agent consumes it, neutralizing injection attempts and preventing malicious instructions from reaching the model. ## Core Features & Use Cases - Hybrid detection pipeline: Combines a six-category regex pattern catalog (role-hijack tokens, tool-use directives, exfiltration, hidden content, encoded payloads) with an LLM analysis pass that confirms hits, catches false positives, and extends spans to cover full malicious directives. - Severity-keyed actions: Low and medium severity passages are replaced with safe [REMOVED: <pattern_class>] markers; any high-severity hit aborts sanitization entirely so the content is never consumed. - Persistent flagged-sources tracking: Maintains docs/security/flagged-sources.md as a git-tracked audit trail, automatically bumping caution levels for repeat-offender files, repos, and domains. - Use Case: Before synthesizing research from a cloned third-party repo, run the sanitizer on each file; injection attempts are stripped or the file is quarantined, and the source is logged for future runs. ## Quick Start Sanitize the content fetched from this external URL before summarizing it, and report any injection attempts found.

Frequently Asked Questions about external-content-sanitizer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I protect an AI agent from prompt injection in fetched web content?

Pass the content through a sanitization step before the agent reads it. This Skill runs a regex pre-pass across six injection categories, then an LLM analysis pass to confirm hits and catch missed attempts, returning sanitized content with malicious passages removed.

How to detect prompt injection in cloned repositories?

Invoke the sanitizer with source_type set to cloned-repo and the file path as source_identifier. It scans for role-hijack tokens, tool-use directives, exfiltration patterns, and hidden content, and tracks repeat-offender repos at the container level.

What happens when a high-severity injection attempt is detected?

The sanitizer aborts entirely and returns no sanitized content. The response lists detected attempts by offset and pattern category only, and the source is added to docs/security/flagged-sources.md for future caution-bumps.

Does the sanitizer work if the LLM analysis call fails?

Yes, it falls back to regex-only severity assignment and includes a warning in the response. This degrades protection to the pattern-catalog layer only, so results should be treated with additional caution.

When should I not run content sanitization?

Skip it for workspace-internal files such as skills, docs, and templates, which are trusted by definition, and for very short trivial content under 50 characters where the overhead exceeds the protection value.

What are the limitations of regex-based prompt injection detection?

Regex catches known signatures but misses subtle social engineering and novel patterns, which is why this Skill adds an LLM analysis pass. It is one layer of defense in depth and should be combined with synthesis guard rails and human review.