Skip to content

feat(logging): functional Presidio PII path + opt-in CI job (v26.06.03)#29

Merged
ancongui merged 2 commits into
mainfrom
ci/presidio-pii-job
Jun 5, 2026
Merged

feat(logging): functional Presidio PII path + opt-in CI job (v26.06.03)#29
ancongui merged 2 commits into
mainfrom
ci/presidio-pii-job

Conversation

@ancongui
Copy link
Copy Markdown
Contributor

@ancongui ancongui commented Jun 5, 2026

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.

  • PresidioRedactor was 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.
  • Configurable model — new pyfly.logging.redaction.presidio.model (default en_core_web_lg) via NlpEngineProvider; falls back to regex if the model isn't installed.
  • Opt-in CI.github/workflows/pii.yml (PII / Presidio) installs pyfly[pii] + en_core_web_sm and runs the e2e test. Triggers: manual dispatch + auto only when redaction code changes. The main CI stays fast (it excludes the pii extra).

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, and mypy --strict + ruff stay clean both ways. Full suite: 3613 passed, 1 skipped.

Released as v26.06.03. (The PII / Presidio workflow will run on this PR since it touches the redaction code.)

Andrés Contreras Guillén 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.
@ancongui ancongui merged commit 0cd0763 into main Jun 5, 2026
6 checks passed
@ancongui ancongui deleted the ci/presidio-pii-job branch June 5, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant