feat(logging): functional Presidio PII path + opt-in CI job (v26.06.03)#29
Merged
Conversation
added 2 commits
June 5, 2026 11:40
…egex pass) + configurable model + opt-in CI job (v26.06.03) - PresidioRedactor now detects with Presidio's full recognizer set (NER catches free-text names etc.) instead of pyfly's regex entity names (which Presidio doesn't recognize), then runs the regex pass so JWT/bearer/URL-cred token-types are still masked. - New pyfly.logging.redaction.presidio.model (default en_core_web_lg) via NlpEngineProvider; CI uses en_core_web_sm. - New .github/workflows/pii.yml 'PII / Presidio' job: installs pyfly[pii] + a small spaCy model and runs the end-to-end presidio test; manual dispatch + auto on redaction-code changes (main CI stays fast). - tests/logging/test_redaction_presidio.py (4, importorskip + skip-if-no-model). Verified: presidio installed + en_core_web_sm -> John Smith-><PERSON>, email/ card masked, JWT masked; without presidio the test skips and mypy/ruff stay clean.
…or the model download
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to the v26.06.02 logging overhaul: make the Presidio PII path actually work and add a dedicated CI job that exercises it end-to-end.
PresidioRedactorwas effectively a no-op. It passed pyfly's regex entity names (EMAIL,IBAN,PHONE…) to Presidio, whose recognizers use different names (EMAIL_ADDRESS,IBAN_CODE,PHONE_NUMBER…) — so Presidio detected almost nothing and always fell back to regex. It now detects with Presidio's full recognizer set (NER for free-text names, locations, etc.) and then runs the regex pass over the result, so token-types Presidio can't detect (JWT, bearer tokens, URL credentials) are still masked.pyfly.logging.redaction.presidio.model(defaulten_core_web_lg) viaNlpEngineProvider; falls back to regex if the model isn't installed..github/workflows/pii.yml(PII / Presidio) installspyfly[pii]+en_core_web_smand runs the e2e test. Triggers: manual dispatch + auto only when redaction code changes. The main CI stays fast (it excludes thepiiextra).Verification (done locally with presidio + en_core_web_sm)
PresidioRedactor.redact("My name is John Smith, email john@acme.io, card 4111111111111111, jwt eyJ…")→<PERSON>,<EMAIL_ADDRESS>,<CREDIT_CARD>, token masked. The 4 e2e tests pass; without presidio they skip, andmypy --strict+ruffstay clean both ways. Full suite: 3613 passed, 1 skipped.Released as v26.06.03. (The
PII / Presidioworkflow will run on this PR since it touches the redaction code.)