-
Notifications
You must be signed in to change notification settings - Fork 6
Adding Korean RRN PII detection #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for detecting Korean Resident Registration Numbers (RRN) in the PII guardrail system, and adds an internal_examples/ directory to .gitignore.
- Added KR_RRN entity type to the PIIEntity enum
- Implemented regex pattern for detecting Korean RRNs in format XXXXXX-XXXXXXX
- Added comprehensive unit tests for both masking and blocking modes
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/checks/pii.ts | Adds KR_RRN enum entry and regex pattern /\b\d{6}-\d{7}\b/g for Korean RRN detection |
| src/tests/unit/checks/pii.test.ts | Adds two test cases verifying KR_RRN detection in both masking (block=false) and blocking (block=true) modes |
| .gitignore | Adds internal_examples/ directory to gitignore |
Comments suppressed due to low confidence (1)
src/checks/pii.ts:66
- The documentation comment should be updated to include Korea in the list of supported regions, since KR_RRN is now being added. Consider updating to: 'Includes global and region-specific types (US, UK, Spain, Italy, Korea, etc.).'
* Includes global and region-specific types (US, UK, Spain, Italy, etc.).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // Korea | ||
| // Format: YYMMDD-GNNNNNN where YY=year, MM=month(01-12), DD=day(01-31), G=gender/century(1-4) | ||
| [PIIEntity.KR_RRN]: /\b\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])-[1-4]\d{6}\b/g, |
Copilot
AI
Oct 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex pattern allows invalid dates like February 30th (0230) or February 31st (0231). The day validation (0[1-9]|[12]\d|3[01]) doesn't account for different month lengths. While month-specific day validation in regex is complex, consider if this level of validation is acceptable or if additional validation logic should be added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now this is fine. All of the checks are basic regex, I would recommend a separate PR that makes all of the checks more robust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM TY
KR_RRNto the PI guardrail