Skip to main content

eucompliance-redact

Strip personal data and credentials from prompts before they reach a model — locally, with a signed record that you did.

Every prompt you send to a hosted model is a transfer to a processor. If it contains a customer address, an IBAN or an API key, that is a disclosure under GDPR Art. 28 — and, for providers outside the EU, Art. 44. The obligation is not politeness, it is liability.

pip install eucompliance-redact
from eucompliance_redact import redact

clean = redact(prompt)
answer = model(clean.text)        # only placeholders left
print(clean.restore(answer))      # placeholders put back

No dependencies. No network calls. Nothing to configure.

Or wrap the client once

from eucompliance_redact import wrap
from openai import OpenAI

client = wrap(OpenAI())
client.chat.completions.create(model="gpt-4o", messages=[...])

Prompts are redacted on the way out and the answer is translated back on the way in, so your users never see a placeholder. If anything in this library fails, the call goes through unchanged — a safeguard that stops production gets switched off.

What it finds

Private keys · AWS keys · GitHub tokens · OpenAI and Anthropic keys · Slack tokens · JWTs · credentials embedded in URLs · IBANs (checksum-verified) · payment cards (Luhn-verified) · e-mail addresses · VAT IDs · IP addresses.

Phone numbers are off by default: almost any long digit sequence looks like one, and invoice numbers are the usual casualty. Enable with include_unsafe=True.

redact(text, skip=["IPV4"])            # leave internal addresses alone
redact(text, kinds=["IBAN", "EMAIL"])  # only these

What it does not find — read this part

This is pattern matching. It finds what has structure: a checksum, a prefix, a shape. It does not find a person's name sitting in ordinary prose, a street address written out in words, or a medical detail described in a sentence. No amount of regular expressions will, and a library that claims otherwise is more dangerous than no library at all, because you would stop looking.

Use it to remove the leaks that are mechanical and constant. Do not use it as your only control over what goes into a prompt.

Placeholders are stable

The same value becomes the same placeholder everywhere in the text, so the model can still tell that two mentions are the same person:

r = redact("a@x.at wrote to b@y.at, then a@x.at again")
r.text
# '[EMAIL_1] wrote to [EMAIL_2], then [EMAIL_1] again'
r.count      # 3 occurrences
len(r.mapping)  # 2 distinct values

Proving you did it

Redaction that nobody can verify is worth little in an audit. receipt() returns a signed record of that redaction happened — how many values of which kinds, and the hashes before and after:

from eucompliance_redact import receipt, redaction_summary

r = redact(prompt)
record = receipt(r, controller="Your Company GmbH", processor="OpenAI")
summary = redaction_summary(record)

Only the two hashes and the per-kind counts are transmitted. Not one redacted value, not one line of the prompt. The record is signed with EIP-191 and verifiable by anyone, free and without an account — at eucompliance.tools/verify.

This is the only part that touches the network, and it is optional. Without it, the package is fully offline.

What the record proves

Proves: that a text with this hash was reduced to a text with that hash, removing this many values of these kinds, at this time, attested by this controller.

Does not prove: that nothing sensitive remained. See the section above. It is evidence of a control being applied, not a guarantee of the result.

Not legal advice. Whether your processing is lawful remains your assessment.

Related

MIT licensed. Operated by Patrick Kaufmann, sole proprietor in Vienna, Austria.

Metadata

Release files for eucompliance-redact 0.1.2

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

Source distribution (sdist)

Source distribution for eucompliance-redact 0.1.2
File Size Uploaded
eucompliance_redact-0.1.2.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for eucompliance-redact 0.1.2
File Interpreter ABI Platform
eucompliance_redact-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 18.5 kB

Release files / eucompliance_redact-0.1.2.tar.gz

Download URL eucompliance_redact-0.1.2.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ffb54aea7e8fc72700e38559acd1f5e8080fb9a0742e0520f58bd66f758578ac
BLAKE2b-256 checksum
How to use checksums
b0d21d2be130609044407301f99afb6abab7145844057f5c4fce26eec02b8436
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / eucompliance_redact-0.1.2-py3-none-any.whl

Download URL eucompliance_redact-0.1.2-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8898c33a7025355cb192fe090152919f572e7ac2b7fa2e60476e7e10e1133a96
BLAKE2b-256 checksum
How to use checksums
e14cb1c6f63298f61b2c6c41e3706810040f1674984dc50a213006d9518a8150
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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