-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(pii): Fix scrubbing user paths in minidump debug modules #4351
Conversation
#[test] | ||
fn supports_byte_mode() { | ||
assert!(regex::bytes::RegexBuilder::new($name.as_str()) | ||
.unicode(false) | ||
.multi_line(false) | ||
.dot_matches_new_line(true) | ||
.build() | ||
.is_ok()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sure the regex can also be used by minidump scrubbing. There are several open questions (see below), but this was the most conservative approach I could think of.
- Why does minidump scrubbing need
.unicode(false)
?relay/relay-pii/src/attachments.rs
Lines 29 to 31 in b5b738f
let regex = match BytesRegexBuilder::new(regex.as_str()) // https://github.com/rust-lang/regex/issues/697 .unicode(false) - Could we automatically generate a non-unicode version of every regex, such that it does not have to be recompiled on the fly for every minidump?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I read the issue and I still don't understand why this is necessary, would be nice if we had a test for this...
- That'd be nice or if we didn't even need the special casing in the first place.
}); | ||
) | ||
( | ||
[^/\\\r\n]+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the change that fixes the regex with unicode disabled, while still meeting the requirements of #2724:
relay/relay-pii/src/builtin.rs
Lines 1247 to 1248 in b5b738f
#[test] | |
fn test_userpath() { |
#[test] | ||
fn supports_byte_mode() { | ||
assert!(regex::bytes::RegexBuilder::new($name.as_str()) | ||
.unicode(false) | ||
.multi_line(false) | ||
.dot_matches_new_line(true) | ||
.build() | ||
.is_ok()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I read the issue and I still don't understand why this is necessary, would be nice if we had a test for this...
- That'd be nice or if we didn't even need the special casing in the first place.
#2724 silently broke user path scrubbing in minidumps. The regression was not automatically flagged because minidump scrubbing ignores regexes that cannot be compiled with unicode disabled, regardless of whether they are user-defined regexes or builtin static ones.
This PR both fixes the regex and adds an automatic test to each PII regex, so we can catch similar problems in the future.