cgh-pii
PII and secret detection for cgh. Once installed, every indexed file is scanned inline for personal data and credentials, and the results land in the finding store:
pip install cgh-pii
cgh index
cgh findings --key pii. # emails, phones, IBANs, cards per file
cgh findings --severity block # private keys, cloud credentials
Detected keys and their severities:
| Key | What | Severity |
|---|---|---|
pii.email |
email addresses | warn |
pii.phone |
international-format phone numbers | warn |
pii.iban |
IBANs, mod-97 validated | warn |
pii.card |
payment card numbers, Luhn validated | warn |
secret.aws_key |
AWS access key ids | block |
secret.private_key |
PEM private key blocks | block |
secret.assignment |
password = "..." style hardcoded credentials |
warn |
Two deliberate properties:
- Finding values never contain the matched data. A finding stores the match count and the first line number, not the email or the IBAN itself: findings feed the full-text index and must not spread what they detect.
- Validation over recall. Cards must pass Luhn, IBANs must pass mod 97, so a random digit run does not flag a file.
The optional NER tier (person names, locations) installs with
pip install "cgh-pii[ner]" and activates with ner = true under
[plugin.pii]; it runs deferred, off the indexing hot path.
Redacting a document
Beyond detecting PII, cgh-pii can produce an anonymized copy of a text or markdown file:
cgh pii redact contract.md --only person --out contract.anon.md
cgh pii redact notes.txt --mode pseudonym --in-place
cgh pii redact report.docx --only person --out report.anon.docx
--only limits the categories (person, location, email,
phone, iban, card, aws_key, private_key; default: all).
--mode placeholder (default) writes numbered tags [PERSON_1],
distinct within the document; --mode pseudonym writes a keyed
<pii.person:hex>, the same token for the same value across documents
when you export a stable CGH_REDACT_SECRET (16+ chars). From code:
codegraph.sdk.redact_text(text, only=["person"]).
Two things to know:
- Names need the NER tier (
pip install "cgh-pii[ner]"). The regex tier does not detect person names; requestingpersonorlocationwithout NER fails with a clear message. Once a name is detected, every literal re-occurrence of it is redacted too, since NER can miss repeat mentions. - Text, markdown and docx. Word documents are redacted with the
docxextra (pip install "cgh-pii[docx]"), body paragraphs and table cells, one shared token map across the whole file. Formatting inside a changed paragraph is flattened (it is the only way to redact PII split across runs, like a bold surname); unchanged paragraphs keep their formatting. A docx needs--outor--in-place. PDF is not supported: real pdf redaction needs an AGPL library; extract the pdf text (see cgh-docs) and redact that.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cgh_pii-0.2.0.tar.gz.
File metadata
- Download URL: cgh_pii-0.2.0.tar.gz
- Upload date:
- Size: 14.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b4286f42bcac7220189aeb2566090a2ae21b6e91ee834fa22c98994ffc105a9
|
|
| MD5 |
eb14001ea8cc8c7886e087c534159fca
|
|
| BLAKE2b-256 |
1c0db63efc4d0766aefab621153acad62e2e0fe7713f2f00702cab72dcb0b8a1
|
Provenance
The following attestation bundles were made for cgh_pii-0.2.0.tar.gz:
Publisher:
release.yml on altikva/cgh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cgh_pii-0.2.0.tar.gz -
Subject digest:
9b4286f42bcac7220189aeb2566090a2ae21b6e91ee834fa22c98994ffc105a9 - Sigstore transparency entry: 2349707571
- Sigstore integration time:
-
Permalink:
altikva/cgh@b2c7aaf6ff5bc42ab9118f2f76ba25e96f288b6d -
Branch / Tag:
refs/tags/v0.11.0 - Owner: https://github.com/altikva
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b2c7aaf6ff5bc42ab9118f2f76ba25e96f288b6d -
Trigger Event:
push
-
Statement type:
File details
Details for the file cgh_pii-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cgh_pii-0.2.0-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1873daa2da324b727504249c05fe4a24b8f4bad8c63e3dba3f97defe93064ce
|
|
| MD5 |
2fc056ed920fb787e347005269cc7e51
|
|
| BLAKE2b-256 |
fe7912d589bfe450a21b0ab664fed9db1f7dd826f23b4f91c640548cf207019a
|
Provenance
The following attestation bundles were made for cgh_pii-0.2.0-py3-none-any.whl:
Publisher:
release.yml on altikva/cgh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cgh_pii-0.2.0-py3-none-any.whl -
Subject digest:
c1873daa2da324b727504249c05fe4a24b8f4bad8c63e3dba3f97defe93064ce - Sigstore transparency entry: 2349707616
- Sigstore integration time:
-
Permalink:
altikva/cgh@b2c7aaf6ff5bc42ab9118f2f76ba25e96f288b6d -
Branch / Tag:
refs/tags/v0.11.0 - Owner: https://github.com/altikva
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b2c7aaf6ff5bc42ab9118f2f76ba25e96f288b6d -
Trigger Event:
push
-
Statement type: