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 or runtime error
  • 2: blocking promptware patterns found

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
  • 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.

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prompt_injection_blocker-0.1.4.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prompt_injection_blocker-0.1.4-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file prompt_injection_blocker-0.1.4.tar.gz.

File metadata

  • Download URL: prompt_injection_blocker-0.1.4.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for prompt_injection_blocker-0.1.4.tar.gz
Algorithm Hash digest
SHA256 4ea36189089c2e8bb901b2fcf328268b665a59408dfef23aa987c30da0a0c541
MD5 f1e753be4e43bf39bd2cc94f2bd67966
BLAKE2b-256 89d93803e745c16353b34c7f67317355d58a94eb5c1e968965360baaf5117144

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompt_injection_blocker-0.1.4.tar.gz:

Publisher: publish.yml on Dragon-Lady/prompt-injection-blocker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file prompt_injection_blocker-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for prompt_injection_blocker-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3274deb0b0a96f431531d5d5523e437b8589f4c4f75f587ba6cc92e67f4203ef
MD5 70acb3572ed4c8553fb893c88f689347
BLAKE2b-256 4f10773c5847be61d3b306ff13291d1e16b3e90d9c1e7a848659cb3cf5ba53a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompt_injection_blocker-0.1.4-py3-none-any.whl:

Publisher: publish.yml on Dragon-Lady/prompt-injection-blocker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page