Repository navigation
fix(pii): Correctly handle cookies - #6380
Conversation
In #5456 we made cookie scrubbing overzealous—applying `"@anything:filter"` to `http.request.header.cookie` leads to that field always being completely deleted, even if it is an array that only contains _some_ sensitive cookies. Instead, we go back to the previous behavior of only applying `"@anything:filter"` to _individual_ sensitive cookies, and handling the catch-all key with a separate rule that matches a regex. Fixes RELAY-279. Fixes #6371.
| { | ||
| "data": { | ||
| "http.request.header.cookie": "[Filtered]", | ||
| "http.request.header.cookie": "session=[Filtered]", |
There was a problem hiding this comment.
This is actually better than before even for existing cases.
| "": { | ||
| "rem": [ | ||
| [ | ||
| "@anything:filter", |
There was a problem hiding this comment.
One small blemish on this fix is that cookies will now sometimes be marked as @anything:filter and sometimes as cookies:filter, depending on whether they were sent individually or as part of a collection. I can't see an easy fix for this.
There was a problem hiding this comment.
cookies:filter provides more information to the user so I think this is fine.
|
|
||
| pub static ANYTHING_REGEX: LazyLock<Regex> = LazyLock::new(|| Regex::new(".*").unwrap()); | ||
|
|
||
| pub static SENSITIVE_COOKIE_NAMES: &[&str] = &[ |
There was a problem hiding this comment.
This list needs to live somewhere; both this file and convert.rs need it. Not sure where it's better to put it.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 36af3eb. Configure here.
| "": { | ||
| "rem": [ | ||
| [ | ||
| "@anything:filter", |
There was a problem hiding this comment.
cookies:filter provides more information to the user so I think this is fine.

In #5456 we made cookie scrubbing overzealous—applying
"@anything:filter"tohttp.request.header.cookieleads to that field always being completely deleted, even if it is an array that only contains some sensitive cookies, or none at all.Instead, we go back to the previous behavior of only applying
"@anything:filter"to individual sensitive cookies, and handle the catch-all key with a separate rule that matches a regex.Fixes RELAY-279. Fixes #6371.