The repository or configuration that created this release differ from a previous release. View details.
agent-input-sanitizer (Python client)
A thin Python bridge to the agent-input-sanitizer
Node.js CLI. The sanitization logic has a single source of truth — the
JavaScript in src/ — so this package shells out to the CLI rather than
re-implementing it, giving a Python pipeline byte-identical verdicts with no
second implementation to keep in sync.
Requirements
- Node.js (>= 22) on
PATH. The sanitizer is JavaScript; something has to run it. There is deliberately no pure-Python fallback.
That's it — pip install agent-input-sanitizer and, with Node available, you're
ready to go. The wheel ships a self-contained, single-file build of the CLI
(the src/ logic and its npm dependencies bundled into one .mjs at release
time), so there is no separate JavaScript checkout to clone and no environment
variable to set. The bundle is a versioned build artifact from src/, not a
hand-maintained port, so it can't drift from the JS.
Optional: point at your own JS checkout
Set AGENT_SANITIZER_CLI to a checkout's bin/sanitize-cli.mjs to override the
bundled CLI (e.g. to run against unreleased src/ changes). When the module is
imported directly from a repo checkout, the source CLI is found automatically.
Usage
from agent_input_sanitizer import sanitize
result = sanitize("untrusted text", html=True)
print(result.cleaned, result.found, result.warnings)
See the package docstring for the full set of entry points (sanitize_text,
classify_prompt, scan_instruction_files, clean_file, and the long-lived
Sanitizer worker).
Secret redaction ([secrets] extra)
The base install is dependency-free. The optional secrets extra adds a
pure-Python secret-redaction engine under agent_input_sanitizer.secrets —
detect-secrets plus custom detectors, benign-value skipping, cross-line
reassembly, PEM collapse, and exact-match redaction of caller-supplied env-var
values. Unlike the sanitizer above it needs no Node.js; its only dependency
is detect-secrets, pulled in by the extra:
pip install "agent-input-sanitizer[secrets]"
Every detect-secrets import lives inside this subpackage, so a plain
import agent_input_sanitizer never touches it. The engine shares the parent
package's invisible-character SSOT (agent_input_sanitizer.invisible) rather
than forking it — a fork would be a silent security regression.
In-process
from agent_input_sanitizer.secrets import RedactorConfig, redact, redact_map
redacted, found = redact("aws_key = AKIAIOSFODNN7EXAMPLE")
# -> ("aws_key = [REDACTED: AWS Access Key]", ["AWS Access Key"])
# Pass provider/host secret values in — config is supplied, never discovered.
cfg = RedactorConfig(host_cred_vars={"GH_TOKEN": "ghp_realtokenvalue123"})
redact("tok=ghp_realtokenvalue123", cfg) # -> ("tok=[REDACTED: GH_TOKEN]", ["GH_TOKEN"])
The rehydration map contract
redact_map(text, config) returns a lossless, two-way view:
{"text": "<redacted>",
"pairs": [{"placeholder": "[REDACTED: …]", "original": "<secret>", "start": <int>}],
"found": ["<type>", ...]}
Substituting each pair["original"] at its start reconstructs the input
byte-for-byte. start is a Unicode code-point offset into text (the field
is start, not start_offset). U+E000 / U+E001 are reserved placeholder
sentinels: input already containing either is refused with
{"unmappable": "input contains reserved sentinel characters"} (fail closed)
rather than producing an ambiguous map.
Daemon vs. one-shot
detect-secrets caches a process-global secret_type → plugin mapping, so a fresh
one-shot call must re-register the plugin set every time — slow under load. Two
console scripts (installed with the extra) cover both modes:
agent-secret-redactor— one-shot: reads text on stdin, writes the redaction result as JSON on stdout. Re-registers plugins per call.agent-secret-redactor-daemon <socket-path>— long-lived Unix-socket server that configures the plugin set once at startup (a warm-up scan primes the cache before it binds, so a bound socket means ready). Wire protocol both directions: a 4-byte big-endian length prefix then that many bytes of UTF-8 JSON. Request{"text", "map", "web_ingress", "env_secrets"}; response is the one-shot result, JSONnullwhen nothing is redacted, or{"error": …}on a scan failure.
Both console scripts import the engine on startup, so they fail loud if the
[secrets] extra (hence detect-secrets) is not installed — fail closed, never
a silent no-op.
Versioning
This package is versioned in lockstep with the npm
agent-input-sanitizer:
each release publishes both at the same version from the same commit, and the
wheel bundles src/ at exactly that version. So pip install agent-input-sanitizer==X.Y.Z and npm i agent-input-sanitizer@X.Y.Z are the
same underlying logic.
Metadata
Release files for agent-input-sanitizer 1.47.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Change of provenance
The repository or configuration that created these release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| agent_input_sanitizer-1.47.14.tar.gz | 291.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agent_input_sanitizer-1.47.14-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 590.9 kB
Release files / agent_input_sanitizer-1.47.14.tar.gz
Change of provenance
This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
| Download URL | agent_input_sanitizer-1.47.14.tar.gz |
|---|---|
| Size | 291.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b9d97c7547d3c0a1614db6bc8d182f6f15526d862ada60adfca872cbf86793db
|
|
BLAKE2b-256 checksum How to use checksums |
3d12de1b9cf2d3c01dc9530ba4a69e0a75e09c2d17d1abd0152200d06dd7905e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.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.
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 Jul 23, 2026.
Transparency logRelease files / agent_input_sanitizer-1.47.14-py3-none-any.whl
Change of provenance
This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
| Download URL | agent_input_sanitizer-1.47.14-py3-none-any.whl |
|---|---|
| Size | 299.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3322f6de658e54590b6e1af621fda38ddc5d593b4551aeb2a7d6d05e1884572f
|
|
BLAKE2b-256 checksum How to use checksums |
7672ec8e4f2f5df19e7790ce03576acc5b95b0e35146d7118da5fdf6e46abce8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.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.
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 Jul 23, 2026.
Transparency logSecurity for agent-input-sanitizer 1.47.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.
Change of provenance
The configuration that created this release differs from a previous release.
While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.
Configuration
- Removed 1.47.11 publish-python.yaml
- Added 1.47.14 auto-version.yaml
Attestation for agent_input_sanitizer-1.47.14.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 Jul 23, 2026.
Transparency logA 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.