Skip to content

feat: added IBAN and passport number detection patterns to PII scanner - #27

Open
AaronProbha18 wants to merge 4 commits into
agentguard-ai:mainfrom
AaronProbha18:feat/PII-pattern-IBAN
Open

feat: added IBAN and passport number detection patterns to PII scanner#27
AaronProbha18 wants to merge 4 commits into
agentguard-ai:mainfrom
AaronProbha18:feat/PII-pattern-IBAN

Conversation

@AaronProbha18

Copy link
Copy Markdown

Description

Adds IBAN and passport-number PII detection to all five active PII-scanning sites in the Python SDK (redaction.py, google_adk.py, observe/pii_scanner.py, pipeline/modules/pre/pii_scanner.py, pipeline/modules/post/output_pii.py), matching them across dict- and dataclass-based sites with consistent iban/passport key naming. Also updates the pre-existing property test that asserted a closed PII-type set, and documentation referencing detected PII categories.

Fixes #457

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring
  • Test improvements

Changes Made

  • Added iban and passport regex patterns to PII_PATTERNS/_PII_PATTERNS dicts in core/audit/redaction.py, integrations/google_adk.py, and observe/pii_scanner.py
  • Appended iban (confidence 0.9) and passport (confidence 0.7) PIIPattern entries to DEFAULT_PII_PATTERNS in pipeline/modules/pre/pii_scanner.py and pipeline/modules/post/output_pii.py, keeping the two lists identical
  • Added IBANPattern/PassportPattern and corresponding map entries to the Go sidecar's governance/patterns.go
  • Added IBAN/passport test coverage to existing tests/core/audit/test_redaction.py, and new test files for observe/pii_scanner.py, both pipeline modules, integrations/google_adk.py, and the Go sidecar
  • Updated tests/test_observe_properties.py's TestPIINonInterference type assertion to include iban/passport
  • Updated packages/tealtiger-python/README.md and packages/tealtiger-sidecar/README.md PII-category references

Testing

  • Unit tests pass (pytest)
  • Type checking passes (mypy src)
  • Linting passes (ruff check src tests)
  • Manual testing performed
  • Added new tests for new functionality

Checklist

  • My code follows the project's code style
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Breaking Changes

  • None. All changes are additive- existing pattern keys, confidence values, and detection behavior for email/phone/ssn/credit_card/ipAddress/apiKey are unchanged.

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.

Add IBAN and passport number detection patterns to PII scanner

1 participant