mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 09:08:33 +00:00
Make E164 log scrubber redact numbers of length >= 7.
This commit is contained in:
parent
d0ce4ff032
commit
110a40592b
@ -32,9 +32,10 @@ public final class Scrubber {
|
||||
|
||||
/**
|
||||
* The middle group will be censored.
|
||||
* Supposedly, the shortest international phone numbers in use contain seven digits.
|
||||
* Handles URL encoded +, %2B
|
||||
*/
|
||||
private static final Pattern E164_PATTERN = Pattern.compile("(\\+|%2B)(\\d{8,13})(\\d{2})");
|
||||
private static final Pattern E164_PATTERN = Pattern.compile("(\\+|%2B)(\\d{5,13})(\\d{2})");
|
||||
private static final String E164_CENSOR = "*************";
|
||||
|
||||
/**
|
||||
|
@ -28,11 +28,11 @@ public final class ScrubberTest {
|
||||
{ "Multiple numbers +447700900001 +447700900002",
|
||||
"Multiple numbers +**********01 +**********02" },
|
||||
|
||||
{ "One less than shortest number +155556789",
|
||||
"One less than shortest number +155556789" },
|
||||
{ "One less than shortest number +155556",
|
||||
"One less than shortest number +155556" },
|
||||
|
||||
{ "Shortest number +1555567890",
|
||||
"Shortest number +********90" },
|
||||
{ "Shortest number +1555567",
|
||||
"Shortest number +*****67" },
|
||||
|
||||
{ "Longest number +155556789012345",
|
||||
"Longest number +*************45" },
|
||||
|
Loading…
x
Reference in New Issue
Block a user