Skip to main content

Prompt Injection Blocker

Read-only scanner for prompt-injection and LLM anti-analysis text in files before agent review.

This tool is meant for defensive intake: copied advisories, incident notes, third-party repositories, docs, issues, and fixtures that may contain text aimed at overriding an AI assistant or suppressing analysis.

It does not remove files, modify content, execute code, contact registries, or prove that content is safe.

Install

pipx install prompt-injection-blocker
# or
pip install prompt-injection-blocker

Python 3.9+. No runtime dependencies.

Usage

prompt-injection-blocker /path/to/project
prompt-injection-blocker /path/to/project --json
prompt-injection-blocker /path/to/project --report report.json

From a source checkout:

python -m prompt_injection_blocker /path/to/project
pip install -e ".[dev]" && pytest

Exit codes:

  • 0: no blocking promptware patterns found
  • 1: usage/runtime error or incomplete scan
  • 2: blocking promptware patterns found

Missing or unsupported targets fail explicitly. Unreadable files/directories, invalid text, and candidate size limits set coverage.complete: false with path/reason entries in coverage.errors. Blocking findings still return 2; otherwise incomplete scans return 1, never 0. Completeness covers only the scanner's selected file types and directory policy, not every repository file.

--report creates a new report exclusively (mode 0600 on POSIX). Existing files, symlinks and hard links are refused, including aliases of scanned inputs. Write failures return 1; a partial newly created report may remain and must not be treated as a successful result. Choose a fresh output path for each run.

What It Flags

  • prompt-injection text that tries to override prior/system/developer instructions
  • text asking an agent to reveal secrets, hidden instructions, environment variables, or tokens
  • text trying to make an agent run commands or fetch external content
  • observability/tool-output text, such as fake Sentry resolutions, that tries to make an agent run package-manager diagnostics
  • LLM-targeted anti-analysis language that tells scanners not to report suspicious content
  • model-scanner refusal/null-result bait that tries to make an analysis pipeline stop before reaching suspicious payload code
  • Microsoft Copilot / AI-assistant links where a q= query parameter appears to carry private-context requests plus external exfiltration instructions
  • cryptographic context injection: encrypted page/tool content plus decrypt-in- sandbox language plus session data or URL-parameter exfiltration (Grok.com "summarize this page" class, Aug 2026). Ciphertext is not readable by input filters; decrypted tool output is untrusted.
  • review-only opaque decryption handoffs: visible text that asks an agent to decrypt or decode content and then obey the result, even when no exfiltration destination is visible. A match does not prove the hidden content is harmful.
  • broad repo-local agent instruction language that deserves review before opening a path in automated agents
  • recognized agent instruction, skill, and MCP configuration paths, even when their contents look benign, so provenance and scope receive human review
  • known phrase families after Unicode compatibility normalization, removal of invisible format characters, and defanging of simple HTML separators

The rules are intentionally conservative. A finding means "do not feed this raw text into an agent," not "this file is malware."

Safe Handling

  • Do not paste flagged text into agents in raw form.
  • Summarize or defang prompt-injection text before sharing with the team.
  • If this appears in a third-party repository, do not open the repo in agents or editors until reviewed.
  • If a test needs one of these markers, split or encode it so the test remains meaningful without carrying live promptware. This codebase stores all of its own detection markers split and joins them at runtime; keep that discipline when adding rules.
  • Treat model refusal as a failed analysis, not a clean result. Send the file through static checks, sandboxing, or human review instead of allowing a null response to pass.
  • Treat unfamiliar setup commands and anything they fetch at runtime as untrusted code. A clean text scan cannot establish what a later network response or package installation will execute.
  • For the October 2026 Copilot CLI cryptographic-context-injection report, constrain the agent's file access and outbound destinations, and review resolved tool actions when untrusted pages are read. The researcher reported continued reproduction on October 1; no fixed Copilot CLI version was identified. Do not treat a clean static scan or model refusal as a fix.

Scope Limits

This scanner only checks text-like files and known phrase families. It will not detect every possible prompt-injection attempt, encoded payload, image-only instruction, runtime-fetched instruction, behavioral setup chain, or model-specific attack. Use it as one deterministic intake layer alongside provenance review, sandboxing, least-privilege tools, network controls, and human approval for consequential actions.

Metadata

Release files for prompt-injection-blocker 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prompt-injection-blocker 0.1.7
File Size Uploaded Provenance Actions
prompt_injection_blocker-0.1.7.tar.gz 19.8 kB With provenance Details for prompt_injection_blocker-0.1.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for prompt-injection-blocker 0.1.7
File Interpreter ABI Platform Actions
prompt_injection_blocker-0.1.7-py3-none-any.whl Python 3 none any Details for prompt_injection_blocker-0.1.7-py3-none-any.whl

Total release size: 32.4 kB

Release files / prompt_injection_blocker-0.1.7.tar.gz

Download URL prompt_injection_blocker-0.1.7.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cc98548c265378d431115589266f661eeb680cdeb33f5b85b9c3ae9e0aa1a4a2
BLAKE2b-256 checksum
How to use checksums
973914eb139a61a07e0769d1877131707c2c128ffe5da4a77b1244267d385a26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / prompt_injection_blocker-0.1.7-py3-none-any.whl

Download URL prompt_injection_blocker-0.1.7-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b3352c579872a1ab2bf55873540e720db276e1cc2db4ba4efe1d0edde73881b
BLAKE2b-256 checksum
How to use checksums
6465d9d6db93fb399efd55787418c5febdfd2f7365b0fc624b9bb7e6905025fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Security for prompt-injection-blocker 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for prompt_injection_blocker-0.1.7.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page