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::{
3838
3939use crate :: metrics:: log_errors_reported_total;
4040
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+
4146/// Replacers for PII in errors before reporting to thirdparty services
4247/// (sentry/datadog)
4348static PII_REPLACEMENTS : LazyLock < Vec < ( Regex , & ' static str ) > > = LazyLock :: new ( || {
4449 vec ! [
4550 // Regex to match PII where we show the object that doesn't match the
4651 // validator.
4752 ( 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( ) , "*****@*****.***" ) ,
5354 ]
5455} ) ;
5556
You can’t perform that action at this time.
0 commit comments