Repository navigation
Commit 5605356
committed
feat(sms): read message text after undoing disguises
Homoglyphs and invisible characters survive SMS and RCS delivery and
hide spam words from rules that read raw text (one Android filter fell
from 89.6% to 41.2% accuracy in arXiv 2609.01171). SmsTextNormalizer
applies NFKC, drops format characters (zero-width, bidi, soft hyphen,
tags), variation selectors and blank-looking letters, and folds
Cyrillic, Greek and IPA letters that render as Latin.
- Folding applies to the whole message when it reads as Latin (Latin
outnumbers Cyrillic and Greek, or every such letter has a Latin twin)
and otherwise only inside words that mix scripts, so Russian and
Greek messages keep their text.
- URL and host checks read the unfolded form, so a Cyrillic look-alike
host is never scored or reported as the real domain; invisible
characters no longer split a host out of the URL pattern.
- A URL host or brand name that hid characters or used look-alikes adds
disguised_text (+30), labeled in en and zh.
- User keyword rules match the text as written or folded on both sides,
keeping their case rules; the checker folds the message once.
- Invisible padding no longer stretches a short message with a link.
Tests: SmsTextNormalizerTest (JVM) and SmsTextNormalizerIcuTest
(Robolectric) share one case table; the ICU test also compares the JDK's
NFKC with ICU's Normalizer2 and the format-character set with
UCharacter over every code point both know. SmsEvaluationCorpusTest
gains zero-width, look-alike, fullwidth and hidden-in-link copies of
every flagged spam example (all stay flagged; run against the previous
analyzer, dozens escaped), and pins false alarms at none, the count
before this change. No existing assertion changed. The corpus README
paragraph said seven locales; it has eight.1 parent e120f25 commit 5605356
12 files changed
Lines changed: 608 additions & 30 deletions
File tree
- app/src
- main
- java/com/sysadmindoc/callshield
- data
- checker
- model
- ui
- res
- values-zh-rCN
- values
- test/java/com/sysadmindoc/callshield/data
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
56 | 62 | | |
57 | 63 | | |
58 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
| 217 | + | |
222 | 218 | | |
223 | 219 | | |
224 | 220 | | |
| |||
509 | 505 | | |
510 | 506 | | |
511 | 507 | | |
512 | | - | |
| 508 | + | |
513 | 509 | | |
514 | 510 | | |
515 | 511 | | |
516 | 512 | | |
517 | | - | |
| 513 | + | |
518 | 514 | | |
519 | 515 | | |
520 | 516 | | |
| |||
551 | 547 | | |
552 | 548 | | |
553 | 549 | | |
554 | | - | |
555 | | - | |
| 550 | + | |
| 551 | + | |
556 | 552 | | |
557 | 553 | | |
558 | 554 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
304 | | - | |
| 304 | + | |
| 305 | + | |
305 | 306 | | |
306 | 307 | | |
307 | 308 | | |
| |||
352 | 353 | | |
353 | 354 | | |
354 | 355 | | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
355 | 362 | | |
356 | 363 | | |
357 | 364 | | |
358 | | - | |
359 | | - | |
| 365 | + | |
| 366 | + | |
360 | 367 | | |
361 | 368 | | |
362 | 369 | | |
| |||
372 | 379 | | |
373 | 380 | | |
374 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
375 | 387 | | |
376 | 388 | | |
377 | 389 | | |
378 | | - | |
| 390 | + | |
379 | 391 | | |
380 | 392 | | |
381 | 393 | | |
| |||
388 | 400 | | |
389 | 401 | | |
390 | 402 | | |
391 | | - | |
| 403 | + | |
392 | 404 | | |
393 | 405 | | |
394 | 406 | | |
395 | 407 | | |
396 | 408 | | |
397 | 409 | | |
398 | 410 | | |
399 | | - | |
| 411 | + | |
400 | 412 | | |
401 | 413 | | |
402 | 414 | | |
403 | 415 | | |
404 | 416 | | |
405 | 417 | | |
406 | | - | |
407 | | - | |
408 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
409 | 421 | | |
410 | 422 | | |
411 | 423 | | |
412 | 424 | | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
417 | 428 | | |
418 | 429 | | |
419 | 430 | | |
| |||
0 commit comments