Repository navigation
Description
Bug: PII protection never masks a date of birth written with a two-digit year
P2. Locally reproduced at current main 4e3c8e40fe05706a5e8796bb30b024b58c1038f9 by the TALE-223 coordinator, with an independent read-only review.
Reproduction and result
With PII protection on in mask mode and every built-in pattern enabled, the shipped scrubber (createScrubber from services/platform/lib/pii) passes these inputs through unchanged:
| Input | Result on main | Expected |
|---|---|---|
DOB: 15/03/87 |
unchanged | the date replaced by [DATE_OF_BIRTH] |
Geburtsdatum: 15.03.87 |
unchanged | the date replaced by [DATE_OF_BIRTH] |
date de naissance : 15/03/87 |
unchanged | the date replaced by [DATE_OF_BIRTH] |
The same dates with a four-digit year (DOB: 15/03/1987) are masked. A two-digit year is a common way to write a date of birth on forms and in messages, so with the Date of birth pattern on in mask mode the date still reaches the model. In a chat it is also stored and shown as written: the guardrails guide says the masked text is what Tale keeps (docs/en/platform/admin/governance/guardrails.md:34). The Date of birth pattern is not among those switched on by default when PII protection is first enabled (services/platform/app/features/settings/governance/components/pii-config.tsx:51-59), so this affects organizations that turned it on.
Root
The pattern file accepts two-digit years. configs/platform/system/pii/patterns/dateOfBirth.yml:16 matches \d{1,2}[./—–-]\d{1,2}[./—–-]\d{2,4}. The native validator then drops every such match: numericDateLooksPlausible first calls yearLooksPlausible (services/platform/lib/pii/patterns/date-of-birth.ts:52-57). That function looks for YEAR_EXTRACT_RE = /\d{4}/ (:48) and returns false when there is no four-digit group. The two- and three-digit years that \d{2,4} admits can therefore never produce a detection.
This is a regression. Before #1710 (040d77862, 2026-05-15) the numeric date-of-birth regex accepted the same \d{2,4} years and had no validator (services/platform/convex/governance/pii/pii_patterns.ts at 040d77862^), so DOB: 15/03/87 was masked. #1710 added yearLooksPlausible, whose comment says it "extracts the 4-digit year". The pattern description (dateOfBirth.yml:7-12) gives only four-digit examples and states the year-plausibility gate (1900..current+1); it does not say that two-digit years were meant to stop being masked.
Evidence and controls
The probe below ran in an admitted, bounded check under Node vitest (pii project, one worker). The three inputs fail. The four-digit-year control is masked.
Probe (uncommitted test in services/platform/lib/pii/)
import { describe, expect, it } from 'vitest';
import { createScrubber } from './index';
const scrubber = createScrubber({
mode: 'mask',
patterns: {
email: true, phone: true, creditCard: true, cvc: true, iban: true, ipAddress: true,
macAddress: true, jwt: true, ssn: true, dateOfBirth: true,
address: { locales: '*' }, nationalId: { locales: '*' },
},
});
const masked = (input: string) => {
const o = scrubber.scrub(input);
return o.kind === 'modified' ? o.text : input;
};
describe('dateOfBirth: numeric dates with a two-digit year', () => {
it.each(['DOB: 15/03/87', 'Geburtsdatum: 15.03.87', 'date de naissance : 15/03/87'])('masks %s', (input) => {
expect(masked(input)).toContain('[DATE_OF_BIRTH]');
});
it('control: the same date with a four-digit year is masked', () => {
expect(masked('DOB: 15/03/1987')).toBe('DOB: [DATE_OF_BIRTH]');
});
});Deduplication and acceptance
All 1,385 issues were searched for PII, date of birth, dateOfBirth, DATE_OF_BIRTH and two-digit years. Earlier PII issues (#1473 address detection, #1618 partial masking of several items, #2656 seeding) are different and closed. The fixture corpus (services/platform/tests/pii/fixtures/*) has no two-digit-year date, so no test pins the current result as intended.
Acceptance: either mask two-digit-year numeric dates as dates of birth, at least next to a date-of-birth keyword of the enabled locales so that bare numeric runs stay unmasked, or remove \d{2} from the regex and state the limitation in the pattern description and the guardrails guide. Keep the four-digit cases and the year-plausibility negatives green.
Limits: only the scrubber was exercised. The chat, model-API and knowledge paths that call it were not run.
Activity
fix(platform): mask two-digit-year dates of birth after a keyword