Skip to main content

peroxide

Peroxide is a simple LLM input sanitiser. It uses only standard Python libraries to minimise the chance of a supply chain attack. Peroxide does not prevent semantic prompt injection.

Currently, this library prevents the following methods of prompt injection

  • Oversized input attacks - truncating input to a configurable maximum length (default 4000 characters) before any processing begins, preventing resource exhaustion
  • HTML entity encoding attacks - decoding entities like <, >, & before processing, preventing attackers from disguising control tokens as HTML-encoded strings
  • URL encoding attacks - recursively decoding percent-encoded strings (e.g. %5BINST%5D -> [INST]), including double and triple encoded payloads (e.g. %2520 -> %20 -> space), preventing attackers from layering encoding to survive single-pass decoders
  • Unicode lookalike attacks - normalising visually similar characters to their canonical forms via NFKC (e.g. [ -> [, / -> /, fi -> fi), and explicitly normalising slash lookalikes not covered by NFKC (e.g. ∕ U+2215, ⧸ U+29F8), preventing attackers from spelling out control tokens using lookalike characters that bypass string matching
  • Invisible character obfuscation - removing zero-width characters (U+200B–U+200F), directional formatting characters (U+202A–U+202E), and the byte order mark (U+FEFF) that attackers insert inside token strings to break pattern matching while remaining invisible to human reviewers

Metadata

Release files for peroxide 1.0.0

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

Source distribution (sdist)

Source distribution for peroxide 1.0.0
File Size Uploaded Provenance Actions
peroxide-1.0.0.tar.gz 5.9 kB Without provenance Details for peroxide-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for peroxide 1.0.0
File Interpreter ABI Platform Actions
peroxide-1.0.0-py3-none-any.whl Python 3 none any Details for peroxide-1.0.0-py3-none-any.whl

Total release size: 13.0 kB

Release files / peroxide-1.0.0.tar.gz

Download URL peroxide-1.0.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
281b71d687ca82a0e02a11b3b8e7783d10240c7b28e98326df07a0ad9dbb2621
BLAKE2b-256 checksum
How to use checksums
636f7a460d7f4766567e76906ad7e755cce635d8bbce21c19052f1e4386cec23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / peroxide-1.0.0-py3-none-any.whl

Download URL peroxide-1.0.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d23866bc01eef383056391f9ecfe430e58dc61279630b131f68f8b9d634abc5a
BLAKE2b-256 checksum
How to use checksums
a5f7a298b0f1ac9fced4e32c0790289480479cb4c0f9eabddda099382464f71a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Security for peroxide 1.0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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