File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -38,18 +38,19 @@ use value::{
38
38
39
39
use crate :: metrics:: log_errors_reported_total;
40
40
41
+ // Regex to match emails from https://emailregex.com/
42
+ pub static EMAIL_REGEX : LazyLock < Regex > = LazyLock :: new ( || {
43
+ Regex :: new ( r#"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])"# ) . unwrap ( )
44
+ } ) ;
45
+
41
46
/// Replacers for PII in errors before reporting to thirdparty services
42
47
/// (sentry/datadog)
43
48
static PII_REPLACEMENTS : LazyLock < Vec < ( Regex , & ' static str ) > > = LazyLock :: new ( || {
44
49
vec ! [
45
50
// Regex to match PII where we show the object that doesn't match the
46
51
// validator.
47
52
( Regex :: new( r"(?s)Object:.*Validator" ) . unwrap( ) , "Validator" ) ,
48
- // Regex to match emails from https://emailregex.com/
49
- (
50
- Regex :: new( r#"(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])"# ) . unwrap( ) ,
51
- "*****@*****.***" ,
52
- ) ,
53
+ ( EMAIL_REGEX . clone( ) , "*****@*****.***" ) ,
53
54
]
54
55
} ) ;
55
56
You can’t perform that action at this time.
0 commit comments