Scan your whole stack
Are you using blackbar-redact?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.1.3
blackbar-redact was last scanned on 30 Nov 2026 at version 0.1.3. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.1.3 LATEST | 30 Nov 2026 | No rules fired |
| 0.1.2 | 30 Nov 2026 | No rules fired |
Findings for v0.1.3. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.1.3; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
Reversible redaction of sensitive values in text.
Mask email addresses, phone numbers, keys and other values before you paste a text into an AI assistant, a ticket or a chat. Keep the mapping in a local vault. Put the real values back into the answer.
blackbar does not detect names of people. It has no language model. It is a set of regular expressions and checksums. A name, a company or a project is masked only if you list it yourself (
terms). It does not promise to find everything else either. Read the masked text before you send it. See What it does not do.
Python 3.10 or newer, standard library only, no network access.
Asking an assistant about a customer ticket, a log or a config file is useful. Pasting the ticket also hands over the customer's email address, their phone number, the server's IP address and sometimes a password. Deleting those by hand is slow, and afterwards the answer talks about "the customer" and you have to put everything back yourself.
blackbar replaces each value by a stable placeholder such as [EMAIL_1], so
the text keeps its meaning ("the same address appears twice"), and restores
the values in whatever comes back, even if the assistant changed the
placeholder's case or wrapped it in Markdown.
>>> from blackbar import mask, unmask
>>> ticket = """Customer Maria Example (maria@example.com, +1 202 555 0164) cannot log in.
... She connects from 198.51.100.23 and her temporary password: Tmp-Example-553
... Logs are in C:\\Users\\mexample\\AppData\\Local\\acme\\app.log"""
>>> m = mask(ticket, terms=["Maria Example", "acme"])
>>> print(m.text)
Customer [TERM_1] ([EMAIL_1], [PHONE_1]) cannot log in.
She connects from [IP_1] and her temporary password: [SECRET_1]
Logs are in C:\Users\[USER_1]\AppData\Local\[TERM_2]\app.log
m.text is what you paste. Without terms=[...] the name and the company
would have stayed in the text. The assistant answers with placeholders, not
always spelled the way it received them:
>>> answer = "Tell **[TERM_1]** to reset it. [email_1]'s account and [PHONE 1] look fine; ignore [EMAIL_9]."
>>> print(unmask(answer, m.vault))
Tell **Maria Example** to reset it. maria@example.com's account and +1 202 555 0164 look fine; ignore [EMAIL_9].
[EMAIL_9] is not in the vault, so it is left alone. unmask_report tells
you about it:
>>> from blackbar import unmask_report
>>> unmask_report(answer, m.vault).unknown
['[EMAIL_9]']
pip install blackbar-redact
The package is called blackbar-redact on PyPI because the name blackbar is
taken by an unrelated project; the import name and the command are blackbar.
It has no dependencies. The latest development version: pip install git+https://github.com/RealAoss/blackbar. You can also copy src/blackbar into
a project.
mask(text, *, kinds=None, terms=None, vault=None) -> Maskedkinds: which detectors to run, by the names shown by blackbar kinds.
None is the default set. The words "default" and "all" are accepted,
so kinds=["default", "uuid"] adds one.terms: literal strings to mask. Matched case-insensitively on word
boundaries, in any script. For Arabic terms the prefix clitics و ف ب ل ك
and the article ال may be attached and stay outside the placeholder
(arabic_clitics=False turns this off).vault: pass the same Vault again to keep placeholders stable across
calls.min_confidence: drop findings below a confidence (0 to 1, default 0).The result has .text, .vault, and .findings, a list of Finding with
kind, start, end, span, confidence and placeholder:
>>> [(f.kind, f.span, f.confidence) for f in m.findings][:3]
[('term', (9, 22), 1.0), ('email', (24, 41), 0.95), ('phone', (43, 58), 0.9)]
>>> m.counts
{'term': 2, 'email': 1, 'phone': 1, 'ip': 1, 'secret': 1, 'user': 1}
The same value gets the same placeholder, also when it is spelled slightly differently: email letter case, phone numbers with other spacing, dashes or Arabic-Indic digits, IBANs with or without spaces, card numbers with or without separators. Different values never share a placeholder.
Exactly these spellings are merged, after Unicode NFC (canonical
composition, so a precomposed é and e + combining accent are one
spelling); compatibility forms are never folded, so x² and x2, or the
fi ligature and fi, stay different values:
| kind | merged |
|---|---|
email, domain, uuid |
letter case (str.lower) |
url |
letter case of the scheme and the host |
phone |
spaces and punctuation, Arabic-Indic and Persian digits, a leading 00 read as + (more than ten digits) |
iban |
spaces, ASCII letter case |
card, mac |
spaces and punctuation (and letter case for mac) |
ip |
the canonical form of the address (2001:0DB8::0:1 = 2001:db8::1) |
term |
letter case (str.lower, so Straße and STRASSE stay different), Arabic and Hebrew diacritics and tatweel, runs of whitespace |
secret, entropy, user |
nothing |
>>> two = mask("Call +1 202-555-0164 or +1 (202) 555 0164")
>>> two.text
'Call [PHONE_1] or [PHONE_1]'
There is a price for that, and it is the one exception to an exact round
trip: both occurrences come back in the spelling that was seen first.
Masked.exact is False when this happened.
>>> two.exact
False
>>> unmask(two.text, two.vault)
'Call +1 202-555-0164 or +1 202-555-0164'
Arabic text and digits:
>>> print(mask("أرسلت العقد لسلمى على ٠٧٧٠٠ ٩٠٠١٢٣", terms=["سلمى"]).text)
أرسلت العقد ل[TERM_1] على [PHONE_1]
Names are not found unless you pass them:
>>> mask("Omar Sample called.").text
'Omar Sample called.'
>>> mask("Omar Sample called.", terms=["Omar Sample"]).text
'[TERM_1] called.'
unmask(text, vault) -> strRestores the original values. It tolerates what language models do to
placeholders: other letter case ([email_1]), spaces ([ EMAIL 1 ]), a dash
or nothing instead of the underscore, a Markdown-escaped underscore or
brackets (\[EMAIL\_1\]), bold, italics or backticks around or inside the
brackets, a possessive or plural suffix ([EMAIL_1]'s), full-width brackets
and letters, Arabic-Indic digits in the number.
It does not restore a placeholder whose brackets were removed (EMAIL_1) or
replaced by other brackets ((EMAIL_1), <EMAIL_1>).
unmask_report(text, vault) returns .text, .restored (a count) and
.unknown (placeholders that are not in the vault; they are left untouched).
VaultThe vault contains the secrets. It maps every placeholder to its original value. A saved vault file is plain, unencrypted JSON with all of them in it. Keep it private, do not commit it, delete it when you are done.
blackbar never writes a vault on its own. You choose the path:
>>> import os, tempfile
>>> from blackbar import Vault
>>> with tempfile.TemporaryDirectory() as folder:
... path = os.path.join(folder, "vault.json")
... m.vault.save(path) # mode 0600 where the OS supports it
... later = Vault.load(path)
>>> unmask("[IP_1]", later)
'198.51.100.23'
On Windows the POSIX mode bits are mostly ignored and the file gets the permissions of its folder.
a.merge(b) adds the entries of another vault. If both vaults used the same
placeholder for different values, the incoming one is renumbered and the
method returns the mapping {placeholder in b: placeholder in a}.
Keyed mode. Vault(key=...) derives the identifier from
HMAC-SHA256(key, kind + NUL + normalised value) instead of counting.
Separate runs with the same key then agree on the placeholders without
sharing a vault:
>>> key = "a long random string that is kept out of the repository"
>>> a = mask("mail maria@example.com", vault=Vault(key=key))
>>> b = mask("MARIA@example.com wrote", vault=Vault(key=key))
>>> a.findings[0].placeholder == b.findings[0].placeholder
True
>>> len(a.findings[0].placeholder) # "[EMAIL_" + 10 hex digits + "]"
18
If the input already contains placeholder-looking text, mask leaves it
alone in both modes and never hands that placeholder out, including every
form unmask would read as it ([EMAIL_01] and [email 1] both count as
[EMAIL_1]). In numbered mode the next free number is used; in keyed mode
the value gets a longer prefix of its HMAC (12 hex digits or more), so in
that run its placeholder differs from the one other runs give it.
Each run still needs its own vault to restore its values. The key is never
written to the vault file. Whoever has the key can test whether a placeholder
stands for a value they guess; see SECURITY.md.
scan(text, ...) and redact(kind, value)scan returns the findings without changing anything. redact gives a short
hint that is safe to print:
>>> from blackbar import scan, redact
>>> text = "ping 192.0.2.7 or jane@example.com"
>>> [(f.kind, redact(f.kind, text[f.start:f.end])) for f in scan(text)]
[('ip', '1***'), ('email', 'j***@e***.com')]
blackbar mask ticket.txt --vault vault.json --terms-file terms.txt -o ticket.masked.txt
blackbar unmask answer.txt --vault vault.json -o answer.restored.txt
blackbar scan ticket.txt --terms-file terms.txt
blackbar kinds
mask [FILE|-] --vault PATH [--kinds LIST] [--exclude LIST] [--terms-file PATH] [--term TEXT] [--min-confidence X] [--key-env NAME] [-o OUT] [--force] [-q]
reads the file or standard input, creates or extends the vault, writes the
masked text to OUT or standard output. The summary on standard error
counts the values and never shows them.unmask [FILE|-] --vault PATH [-o OUT] [--force] [--strict] restores.
Placeholders that are not in the vault are listed on standard error;
--strict makes that exit status 3.scan [FILE|-] [--kinds ...] [--terms-file ...] [--json] [--fail-on-findings]
only reports. Values are shown redacted, never in full.kinds lists the kinds; kinds --aliases also lists other accepted names
(ipv4, credit_card, ...).--terms-file is a UTF-8 file with one term per line; lines starting with #
are comments. --key-env NAME switches to keyed mode and reads the key from
the environment variable NAME, so that it does not end up in the shell
history.
An existing output file is never overwritten unless you pass --force, and
the output may not be the input or the vault. Input and output are UTF-8 on
every platform, including the Windows console; line endings are kept as they
are.
For the ticket of the example above, with Maria Example and acme in
terms.txt, blackbar scan ticket.txt --terms-file terms.txt prints
(line:column, kind, confidence, hint):
1:10 term 1.00 M***
1:25 email 0.95 m***@e***.com
1:44 phone 0.90 +***64
2:19 ip 0.90 1***
2:61 secret 0.80 *** (15 chars)
3:22 user 0.85 m***
3:45 term 1.00 a***
In a pipe (your-assistant stands for whatever you use):
cat ticket.txt | blackbar mask --vault vault.json | your-assistant | blackbar unmask --vault vault.json
Confidence is a rough, hand-assigned number, not a calibrated probability.
"Default" says whether the kind runs when you do not pass kinds.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.