maskerade
A local masking proxy for the Anthropic API. It runs on your own machine, replaces client data in your prompts and traffic with typed placeholders before anything is sent, and puts the real values back into the reply.
Built for penetration testers who use Claude (Claude Code, the SDKs, anything that speaks the Messages API) on client work and must not send client data to a third party.
your client (Claude Code, SDK) maskerade, on 127.0.0.1 api.anthropic.com
────────────────────────────── ────────────────────────── ─────────────────
"admin is jan.novak@acmebank.cz" ──▶ detect + mask ──▶ "admin is [EMAIL_ADDRESS_1]"
"reset it for jan.novak@acmebank.cz" ◀── restore real values ◀── "reset it for [EMAIL_ADDRESS_1]"
Status: alpha (0.1.5). It reduces what leaves your machine; it does not guarantee that nothing sensitive does. Read What it does not do before relying on it, and keep reviewing what you send.
How it works
- Detects client data with deterministic layers: your own rules (the client's names, domains and tenant slugs), around 100 regex patterns for credentials, tokens, keys, hashes, IPs, hostnames, emails and national IDs, checksum validators (IBAN, card numbers, national ID numbers), key/value structure (
"password": ...), identifier shapes, and a randomness test for secrets nobody has a pattern for. The optional NER tier adds a local GLiNER model for names and organisations. - Masks each value with a typed placeholder such as
[INTERNAL_HOSTNAME_1]. The same value gets the same placeholder for the whole conversation, so the model can still reason about it ("[USER_ID_1]can read[USER_ID_2]'s invoices"). - Forwards only the masked request to
api.anthropic.com, and appends a short note telling the model what the placeholders mean. - Restores the real values in the reply, including streamed replies and tool-call arguments, so your client sees the real text.
- Fails closed. If a detector cannot run, or a detected value cannot be masked, the request is refused, never forwarded unmasked.
Everything runs locally on the CPU. No GPU, no model server, no account.
Supported clients
| Client | Through maskerade? |
|---|---|
claude command-line tool (Claude Code) |
Yes, with a Claude subscription login or an API key. This is the main use; see Quick start. |
| Claude desktop app in third-party mode | Yes, with an Anthropic API key only (subscriptions don't work in this mode). See Claude desktop app. |
| Claude desktop app signed in with a Claude account | No. Chat, Cowork and the Code tab all talk to Anthropic directly, even in a folder maskerade init prepared. |
| claude.ai in a browser | No. |
| Anything else that speaks the Messages API (SDKs, scripts) | Yes, by setting ANTHROPIC_BASE_URL. |
Install
Python 3.11 or newer.
pip install maskerade
python -m maskerade.warm # one-time: fetches the 1.6 MB BPE encoder, checksum-verified
maskerade --version
warm is required: the entropy detector needs that encoder, and without it the proxy refuses to start rather than run with a weaker detector. Behind a proxy, set HTTPS_PROXY for this command; for a machine with no internet access at all, see the end of Command reference.
Full tier (adds the NER model)
The ner extra pulls in PyTorch and the GLiNER model, a few GB in total. Install the CPU build of PyTorch first; otherwise pip fetches the much larger CUDA build, which this tool cannot use:
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install "maskerade[ner]"
python -m maskerade.warm --full # one-time: encoder + model (~1.2 GB)
Run it with --tier full. Startup takes noticeably longer while the model loads.
Docker
Images are published to ghcr.io/adamectimotei/maskerade: 0.1.5 (fast tier, ~190 MB) and 0.1.5-ner (full tier, model included, ~2.6 GB). See Docker below before running one: how you publish the port matters.
Quick start with Claude Code
From the directory you'll work in for the engagement:
maskerade init --engagement eng-2026-014
init asks for the client's names and domains and writes them to .maskerade/rules.txt. It points the claude command-line tool at the proxy through .claude/settings.local.json (the desktop app ignores that file; see Supported clients), and warns you about places the client's name already appears in clear text (the folder path, git remote, branch). It writes no credentials anywhere.
Then start the proxy from that same directory and use Claude Code as usual:
maskerade proxy --engagement eng-2026-014 # fast tier (default)
maskerade proxy --engagement eng-2026-014 --tier full
For any other client, point it at the proxy yourself:
export ANTHROPIC_BASE_URL=http://127.0.0.1:8787 # bash
$env:ANTHROPIC_BASE_URL = "http://127.0.0.1:8787" # PowerShell
Your API key, or your Claude subscription login, works unchanged; the proxy passes your credentials through and never stores or logs them.
Claude desktop app
Only in the app's third-party mode, which sends Chat, Cowork and Code to a gateway you choose, and only with an Anthropic API key: usage is billed to the API, not to a Claude subscription. Tested with the Code tab.
- Start the proxy from the engagement directory, as above.
- In the app: Help → Troubleshooting → Enable Developer Mode, then Developer → Configure Third-Party Inference…
- Under Connection, set:
- Inference provider: Gateway
- Gateway base URL:
http://127.0.0.1:8787 - Gateway API key: your Anthropic API key
- Gateway auth scheme: x-api-key
- Apply Changes, then Save & Restart, and on the sign-in screen start with the third-party configuration.
To go back to your normal setup, choose the Anthropic sign-in on the sign-in screen. Signed in that way, nothing in the app goes through maskerade.
Custom rules: the client's own identity
No detector can know your client's name in advance, so tell it. .maskerade/rules.txt is one value per line:
# acme bank, engagement 2026-014
acmebank.cz
Acme Bank a.s. = CLIENT_NAME
ACME-PAYROLL = CLIENT_SYSTEM
- A bare line becomes
[CLIENT_1],[CLIENT_2], ...;value = TYPEpicks the type. - Matching is case-insensitive and on word boundaries. A domain covers all its subdomains, so
acmebank.czalso masksportal.acmebank.cz. - An email address on a client domain is masked whole, as
[EMAIL_ADDRESS_n], never cut in half by a rule. - The proxy re-reads the file when it changes. Check a file before trusting it:
maskerade rules check .maskerade/rules.txt --against sample.txt
Tiers
| fast (default) | full (--tier full) |
|
|---|---|---|
| Install | pip install maskerade |
maskerade[ner] + CPU PyTorch |
| Detectors | custom rules, ~100 regex patterns, entropy/format, key/value, checksums, identifier shapes | all of fast, plus GLiNER (names, organisations, locations) with an evidence gate for organisation names |
| Speed | milliseconds per message | slower; the model runs on CPU |
| Catches less of | free-text person and company names your rules don't list | very large bodies: the model skips inputs over 16 384 characters, the other detectors still run |
Measured detection (0.1.0, 25 Oct 2026)
Measured with no rules file, which is the worst case; your rules only add to this. Two test sets, both private:
- 30 annotated pentest prompts, 435 values: names, companies, hostnames, credentials, IDs
- 1,060 HTTP requests and responses from open-source web apps, 1,909 values. 364 of these messages contain nothing sensitive.
| fast | full | |
|---|---|---|
| Prompts: values masked | 81.6% | 92.0% |
| Prompts: masked completely | 79.3% | 88.7% |
| HTTP traffic: values masked | 94.8% | 95.7% |
| HTTP traffic: masked completely | 94.5% | 95.1% |
| Prompts: placeholders that hit a real value | 81.4% | 79.7% |
| HTTP traffic: placeholders that hit a real value | 52.8% | 46.3% |
| Time per message, laptop CPU (i7-1365U) | milliseconds | ~1.5 s for traffic, ~3-5 s for a prompt; up to ~20 s for large bodies |
Masked completely also requires every word of a multi-word value to be masked: Jan [PERSON_1] counts as masked but not as completely masked.
What it misses most:
- In HTTP traffic, application-specific identifiers with no recognisable shape. These are 72 of the 83 misses.
- In prompts, internal hostnames without a
.corp/.local-style suffix. - On the fast tier, free-text person and company names: only 38% are caught without the model.
Over-masking is deliberate: 160 of the 364 harmless HTTP messages still got at least one placeholder.
Caveat: both test sets were built by the author, and the prompt set was also used during development. Treat these numbers as indicative, not independent. Put everything you know about the client in your rules file.
Is it working?
- Startup banner. The proxy prints the bind address, the detector set (
mode), where mask maps live, the engagement and which rules file it loaded.custom rule nonemeans no rules file was found. - Every response carries headers:
X-Maskerade-Mode: the detectors that ranX-Maskerade-Session: the session, andneworcontinuedX-Maskerade-Rules: how many of your rules are loadedX-Maskerade-Unscanned: request fields forwarded without inspection (see below)X-Maskerade-Refused: set when a request was refused instead of sent
- Health check:
curl http://127.0.0.1:8787/healthz - Loopback only:
netstat -ano | findstr 8787(Windows) orss -ltnp | grep 8787should show127.0.0.1:8787and nothing else.
Mask maps, sessions and retention
The mapping from placeholders to real values (the mask map) is stored per conversation, so the same value keeps the same placeholder across turns and the reply can be restored. It is client data. It lives in:
| OS | default location |
|---|---|
| Windows | %LOCALAPPDATA%\maskerade (deliberately not Documents, which OneDrive syncs) |
| Linux | $XDG_STATE_HOME/maskerade, or ~/.local/state/maskerade |
| macOS | ~/Library/Application Support/maskerade |
Set MASKERADE_STATE_DIR to put it elsewhere. The files are restricted to your user. On Linux and macOS the proxy refuses to start if it cannot do that; on Windows it prints a warning. It also warns if the location looks like a cloud-synced folder.
maskerade sessions list # ids, labels, placeholder COUNTS; never values
maskerade sessions purge --older-than 30d
maskerade sessions purge --session eng-2026-014 # one engagement
maskerade sessions purge --all
Sessions unused for 30 days are deleted when the proxy starts (--retention-days to change it).
Docker
From the engagement directory, with docker-compose.yml from this repository:
export MASKERADE_ENGAGEMENT=eng-2026-014 # bash
$env:MASKERADE_ENGAGEMENT = "eng-2026-014" # PowerShell
docker compose -f path/to/docker-compose.yml --project-directory . up -d
The compose file refuses to start without MASKERADE_ENGAGEMENT. It mounts ./.maskerade from the engagement directory read-only, so the container picks up the rules file that maskerade init writes there; without pip on the host, create .maskerade/rules.txt by hand (see Custom rules). For the full tier, switch to the -ner image and add --tier full, as the comments in the file show.
The proxy refuses to listen anywhere but loopback unless given --allow-remote. Inside a container a loopback-only proxy is unreachable from the host, so the image listens on all interfaces inside the container, and the port publish is what keeps it on your machine:
docker run -p 127.0.0.1:8787:8787 ... # correct: reachable from this machine only
docker run -p 8787:8787 ... # WRONG: anyone on your network can use it
The proxy has no authentication, holds your mask maps and restores real values, so a wrong publish exposes client data to your whole network. The compose file gets this right and explains it. Also:
- Other containers on the same Docker network can reach the proxy. Don't attach it to networks shared with things you don't trust.
- Keep mask maps in a named volume (the compose file does). The proxy refuses a bind-mounted directory it cannot restrict to its own user.
- The first start downloads the 1.6 MB encoder into the volume. Later starts, including the NER image's, need no network beyond
api.anthropic.com. - The images are tested on Linux with Docker Engine. Docker Desktop on Windows and macOS is not tested yet.
What it does not do
Read this before you depend on it.
- Only message content is inspected. The system prompt, tool definitions and several other request fields are forwarded as-is, because masking them breaks the client. Every response names them in
X-Maskerade-Unscanned. For Claude Code these fields include your working directory, home directory, git remote and branch, and your account name, so work from a neutrally named directory (maskerade initchecks for this). - Images and PDFs are forwarded unmasked. Their bytes cannot be masked, so a pasted screenshot, or an image file the agent reads, reaches Anthropic as it is. They are named in
X-Maskerade-Unscanned(image,document). The text of a plain-text document, and a document's title and context, are masked. - Detection is not complete. A value no rule, pattern or model recognises goes through. The fast tier in particular misses free-text names that aren't in your rules.
- It only proxies the Anthropic Messages API (
/v1/messages,count_tokens,/v1/models, and the OAuth token refresh). Any other path is refused. - It only covers traffic sent through it. Your client's telemetry, update checks and other requests do not go through
ANTHROPIC_BASE_URL. For Claude Code,CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1(whichinitsets) turns most of them off. With a non-Anthropic base URL, Claude Code also disables some features, such as MCP tool search and Remote Control. - It over-masks on purpose. Harmless values are sometimes masked too, because missing a real one costs far more. For example,
?email%3Dname%40example.combecomes?[EMAIL_ADDRESS_1], losing the parameter name along with the address. - No authentication. Anyone who can reach the port can use it. Keep it on loopback.
Command reference
maskerade init --engagement NAME [--client NAME ...] [--domain DOMAIN ...]
maskerade proxy [--engagement NAME] [--tier fast|full] [--port 8787]
[--custom-rules FILE] [--config FILE] [--state-dir DIR]
[--retention-days 30] [--no-system-note | --system-note FILE]
maskerade rules check FILE [--against SAMPLE]
maskerade sessions list | purge (--all | --older-than Nd | --session ID) [--yes]
maskerade --version
python -m maskerade.warm [--full] [--to DIR] [--check] [--traceback]
--help on any subcommand has the details. --config FILE replaces the packaged detection config rather than merging with it, so start from a copy of maskerade/default_config.yaml. For an offline machine, run python -m maskerade.warm --full --to DIR on a connected one, copy the folder over, and set the variables it prints.
Security
Report vulnerabilities privately, as described in SECURITY.md. Never include real client data in a report.
Licence
Apache-2.0. See LICENSE.
The BPE encoder (cl100k_base) is not redistributed here; maskerade.warm downloads it from its publisher. The full tier's model, fastino/gliner2-privacy-filter-PII-multi, is Apache-2.0 and is included in the -ner Docker image.
Metadata
Release files for maskerade 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| maskerade-0.1.5.tar.gz | 320.3 kB | With provenance | Details for maskerade-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| maskerade-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for maskerade-0.1.5-py3-none-any.whl |
Total release size: 648.2 kB
Release files / maskerade-0.1.5.tar.gz
| Download URL | maskerade-0.1.5.tar.gz |
|---|---|
| Size | 320.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51d272ebe2a404093eab5814cd44a0ff99b1fd7adfd5782ec3400b351d57b1bf
|
|
BLAKE2b-256 checksum How to use checksums |
7db9b820334bcf2e1c7f44acfcd24f26b7ff8762f123772a836ffb48502a3d25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 31, 2026.
Transparency logRelease files / maskerade-0.1.5-py3-none-any.whl
| Download URL | maskerade-0.1.5-py3-none-any.whl |
|---|---|
| Size | 327.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47a5203297aa32b776e83dbff68102efabf2cf1eff0a2f242d9a50ed45ede41e
|
|
BLAKE2b-256 checksum How to use checksums |
e3a797a16525ae800c62a8dbce49aeb6b1130cf504ef112651b53f044e983f64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Oct 31, 2026.
Transparency logSecurity for maskerade 0.1.5
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for maskerade-0.1.5.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 Oct 31, 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.