Skip to main content

arcjet-sensitive-info-rampart

Arcjet helps developers protect their apps in just a few lines of code. Implement rate limiting, bot protection, email verification, and defense against common attacks.

This package is the recommended detection backend for Arcjet's sensitive information rule. It runs the on-device Rampart named-entity-recognition model — a ~15 MB quantized ONNX model — so the rule can detect names, addresses, government/financial identifiers, and contact details. Everything runs locally; no data leaves your environment, and the model weights are bundled so nothing is fetched at runtime.

Installation

Install Arcjet with the sensitive-info-rampart extra, which pulls in this package and its runtime dependencies (onnxruntime, tokenizers, numpy):

pip install "arcjet[sensitive-info-rampart]"

Usage

Pass the backend to the detect_sensitive_info rule via its backend option. The rest of the rule — mode, allow/deny, and the result shape — works as documented for the rule.

import os

from arcjet import arcjet, detect_sensitive_info, Mode
from arcjet_sensitive_info_rampart import rampart

aj = arcjet(
    key=os.environ["ARCJET_KEY"],
    rules=[
        detect_sensitive_info(
            mode=Mode.LIVE,
            # Every Rampart entity is a built-in type.
            deny=["EMAIL", "GIVEN_NAME", "SURNAME", "STREET_NAME", "SSN"],
            backend=rampart(),
        ),
    ],
)

decision = await aj.protect(
    request,
    sensitive_info_value="My name is Alex Rivera and my SSN is 472-81-0094.",
)

It also works with arcjet.guard:

from arcjet.guard import LocalDetectSensitiveInfo
from arcjet_sensitive_info_rampart import rampart

sensitive = LocalDetectSensitiveInfo(deny=["GIVEN_NAME", "SSN"], backend=rampart())

Detected entities

The model detects: GIVEN_NAME, SURNAME, EMAIL, PHONE_NUMBER, URL, TAX_ID, BANK_ACCOUNT, ROUTING_NUMBER, GOVERNMENT_ID, PASSPORT, DRIVERS_LICENSE, BUILDING_NUMBER, STREET_NAME, SECONDARY_ADDRESS, CITY, STATE, and ZIP_CODE.

Deterministic recognizers additionally detect the structured, validatable types EMAIL, URL, IP_ADDRESS, SSN, and CREDIT_CARD_NUMBER (Luhn-validated), mirroring Rampart's deterministic redaction layer. Phone numbers are left to the model because their digit shape overlaps with financial and government identifiers. On overlapping text the recognizer result wins over the model.

Phone recognizer migration

The default recognizer set no longer includes the deterministic phone recognizer. Phone numbers are detected by the model by default, reducing false positives for bank accounts, routing numbers, and government identifiers. If you intentionally relied on the previous deterministic behavior, opt back in with RampartOptions(recognizers=(*default_recognizers, phone_recognizer)).

The full set is exported as rampart_entities:

from arcjet_sensitive_info_rampart import rampart, rampart_entities

detect_sensitive_info(deny=list(rampart_entities), backend=rampart())

Options

from arcjet_sensitive_info_rampart import RampartOptions, default_recognizers, rampart

rampart(
    RampartOptions(
        # Minimum confidence for a model token to count (default: 0.5).
        threshold=0.6,
        # ONNX Runtime execution providers (default: ("CPUExecutionProvider",)).
        providers=("CPUExecutionProvider",),
        # Add or replace the deterministic recognizers. This is the extension
        # point for custom detection with this backend.
        recognizers=(*default_recognizers, my_recognizer),
        # Max characters scanned per request (default: DEFAULT_MAX_INPUT_CHARS,
        # i.e. 100_000). Longer input is truncated before detection and a
        # warning is logged. See "Limiting input size" below.
        max_input_chars=100_000,
    )
)

The model loads once on first use and is reused for every request. The token-based detect callback of the detect_sensitive_info rule is not used by this backend; add a recognizer instead.

Limiting input size

Inference is synchronous and its cost grows with the input length, so an unbounded value is a denial-of-service vector. By default the backend scans at most DEFAULT_MAX_INPUT_CHARS (100,000) characters per request; longer input is truncated to that prefix before detection and a warning is logged. Raise the limit to scan larger payloads (at the cost of latency), or lower it to tighten the per-request bound:

from arcjet_sensitive_info_rampart import (
    DEFAULT_MAX_INPUT_CHARS,
    RampartOptions,
    rampart,
)

# Scan up to 500k characters instead of the default 100k.
backend = rampart(RampartOptions(max_input_chars=500_000))

# Or tighten it for a latency-sensitive path.
strict = rampart(RampartOptions(max_input_chars=10_000))

print(DEFAULT_MAX_INPUT_CHARS)  # 100000

License

The source code of this package is licensed under the Apache License, Version 2.0 © Arcjet Labs, Inc.

Bundled model

This package bundles the Rampart model and its tokenizer/configuration files (under src/arcjet_sensitive_info_rampart/models/rampart/), which are a separate work:

"Rampart: Client-side PII redaction for AI assistants" by National Design Studio, Copyright 2026 National Design Studio, licensed under CC BY 4.0. The files are redistributed unmodified.

The full model license is in models/rampart/LICENSE and the attribution is recorded in NOTICE. If you redistribute this package or the model files, retain that attribution as required by CC BY 4.0.

Metadata

Release files for arcjet-sensitive-info-rampart 1.5.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 arcjet-sensitive-info-rampart 1.5.0
File Size Uploaded Provenance Actions
arcjet_sensitive_info_rampart-1.5.0.tar.gz 11.8 MB Without provenance Details for arcjet_sensitive_info_rampart-1.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for arcjet-sensitive-info-rampart 1.5.0
File Interpreter ABI Platform Actions
arcjet_sensitive_info_rampart-1.5.0-py3-none-any.whl Python 3 none any Details for arcjet_sensitive_info_rampart-1.5.0-py3-none-any.whl

Total release size: 23.6 MB

Release files / arcjet_sensitive_info_rampart-1.5.0.tar.gz

Download URL arcjet_sensitive_info_rampart-1.5.0.tar.gz
Size 11.8 MB
Tags Source
SHA-256 checksum
How to use checksums
24e634024099760c8b3174424d6a6591911d2ead92334d09ee2c76fd83894732
BLAKE2b-256 checksum
How to use checksums
e39a48f1c6e0cee8995b9f148ac55a23626fc451929c4cb1038a4c0a1588ffe6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / arcjet_sensitive_info_rampart-1.5.0-py3-none-any.whl

Download URL arcjet_sensitive_info_rampart-1.5.0-py3-none-any.whl
Size 11.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
965b67db050b3cc6e386f2518450a8d5ef4dda72a659f46b947d7460483f69cd
BLAKE2b-256 checksum
How to use checksums
a7047dff9671b836708af952f8a42fd8a579dfc9340b579232e854224c169d76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for arcjet-sensitive-info-rampart 1.5.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.

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