Skip to main content

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

Project description

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

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.

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, or model-specific attack.

Project details


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.3.tar.gz (12.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.3-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: prompt_injection_blocker-0.1.3.tar.gz
  • Upload date:
  • Size: 12.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.3.tar.gz
Algorithm Hash digest
SHA256 4e22ef124de6da24e3eefffe57be1959ee965da3c0c8d9c901129ff0107ec3da
MD5 92c6a1f36f75b5f3428e42ea095e6bd2
BLAKE2b-256 6f322c4ae625e9ddec4e5efd9c0566d9c145972f4495651e3f630f6a0d5e01f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompt_injection_blocker-0.1.3.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.3-py3-none-any.whl.

File metadata

File hashes

Hashes for prompt_injection_blocker-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4e20091cc2d35be3dcbb4deb5844daf1f37819e574627210c0887839567fbcb9
MD5 32b62342fd22174498953a2b30620f8d
BLAKE2b-256 9be6b2028b2bbb2b9add02ebaf8a2a205eea6770eb5b9f91f3b6811115e9b6d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for prompt_injection_blocker-0.1.3-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 Pingdom Monitoring Sentry Error logging StatusPage Status page