Withhold an SSN's last four, a code before ", thanks" and a recovery phrase written with commas or numbers

"ssn ending 1234" and "ssn last four 1234" are private again, as before
this change; a code may be followed by a comma, "cheers", "thanks a
lot" or more than one "!"; a recovery phrase is twelve BIP39 words in a
row, so commas, numbering, a closing period or "my seed is" before it no
longer hide it. The spelled-out email patterns start only at a word, which
keeps long inputs fast.

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju committed 2026-11-18 18:38:13 -08:00
1 parent 2487500927
commit 3f5221b837
3 files changed
+49 -20

No files matched your search

+20
View File
@@ -462,6 +462,18 @@ test('spelled-out emails, addresses, phrases, codes and short phone numbers stay
'the code to my door is 4821',
'AB 12 34 56 C',
'my id is AB12345',
'ssn ending 1234',
'ssn last four 1234',
'SSN ends in 6789',
'otp ABCDEF, thanks',
'pin AbCd, thanks',
'otp ABCDEF thanks!!',
'verification code ABCDEF thanks a lot',
'otp ABCDEF cheers',
'abandon ability able about above absent absorb abstract absurd abuse access accident.',
'abandon, ability, able, about, above, absent, absorb, abstract, absurd, abuse, access, accident',
'1. abandon 2. ability 3. able 4. about 5. above 6. absent 7. absorb 8. abstract 9. absurd 10. abuse 11. access 12. accident',
'my seed is abandon ability able about above absent absorb abstract absurd abuse access accident',
'My ID 12345',
'john at gmail .com',
'john at gmail punto com',
@@ -628,3 +640,11 @@ test('a line longer than a place name is never sent for suggestions', async () =
await service.suggest('1 2 3 4 5 6 7 8 9 10 11');
assert.equal(sent, 1);
});
test('a long line is read quickly', () => {
for (const unit of ['a-', 'a.', '1-', 'a ', '//[a:']) {
const started = performance.now();
mayBePrivate(unit.repeat(10000));
assert.ok(performance.now() - started < 1000, unit);
}
});