Repository navigation
Description
Bug: PII protection does not mask IPv6 addresses that end in ::
P3. 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 passes these inputs through unchanged:
| Input | Result on main | Expected |
|---|---|---|
subnet 2001:db8:abcd:12:: is ours |
unchanged | subnet [IP_ADDRESS] is ours |
router fd12:3456:789a:1:: here |
unchanged | router [IP_ADDRESS] here |
Compressed addresses with a final group (2001:db8::1) are masked. The pattern file promises "IPv6 (including compressed and IPv4-mapped forms …)" and says private or reserved ranges are masked on purpose because "internal topology is PII" (configs/platform/system/pii/patterns/ipAddress.yml:1-9). RFC 5952 canonical text ends an address with :: when its last two or more groups are zero and no earlier run of zero groups is as long (sections 4.2.2-4.2.3), for example a subnet's router address or a network written as an address.
Root
configs/platform/system/pii/patterns/ipAddress.yml:13. The IPv6 alternative (?:[0-9a-fA-F]{0,4}:){2,7}(?:(?:\d{1,3}\.){3}\d{1,3}|[0-9a-fA-F]{1,4}) requires a final hex group or embedded IPv4 after the last colon. The regex never matches the whole address. For 2001:db8:abcd:12:: it backtracks to the truncated candidate 2001:db8:abcd:12, which the isIP validator (services/platform/lib/pii/patterns/ip-address.ts, called from lib/pii/engine/detector.ts:47-58) rightly rejects. For the full address the validator would accept it; that comes from the IPv6 grammar of validator's isIP and was not separately executed here.
This is a regression. Before #1710 (040d77862) the IPv6 branch was (?:[0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4} (services/platform/convex/governance/pii/pii_patterns.ts at 040d77862^), which matched a trailing :: for isIP to accept. #1710 changed the last group to {1,4}.
Evidence and controls
The probe below ran in an admitted, bounded check under Node vitest (pii project, one worker). Both inputs fail. The control gateway 2001:db8::1 ok gives gateway [IP_ADDRESS] ok.
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('ipAddress: compressed IPv6 addresses that end in ::', () => {
it.each([
['subnet 2001:db8:abcd:12:: is ours', '2001:db8:abcd:12::'],
['router fd12:3456:789a:1:: here', 'fd12:3456:789a:1::'],
])('masks %s', (input, address) => {
expect(masked(input)).not.toContain(address);
});
it('control: a compressed IPv6 address with a final group is masked', () => {
expect(masked('gateway 2001:db8::1 ok')).toBe('gateway [IP_ADDRESS] ok');
});
});Deduplication and acceptance
All 1,385 issues were searched for IPv6, IP_ADDRESS, ipAddress and PII. No issue covers IP-address detection. The fixture corpus contains no address ending in ::.
Acceptance: an IPv6 address in compressed form ending in :: (with at least one leading group, optionally a %zone) is masked. The unspecified address :: on its own and version-number negatives may stay unmasked. Add positives to the corpus or smoke.test.ts.
Limits: only the scrubber was exercised; the paths that call it were not run.
Activity
fix(platform): mask IPv6 addresses that end in ::
fix(platform): mask IPv6 addresses that end in ::