fix(core): Apply the sensitive denylist to cookie headers and configured fetch headers - #24090
fix(core): Apply the sensitive denylist to cookie headers and configured fetch headers#24090s1gr1d wants to merge 4 commits into
Conversation
…red fetch headers Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
size-limit report 📦
|
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 7ec524d. Configure here.
| */ | ||
| function parseCookieHeader(value: string, isSetCookie: boolean): Record<string, string> | undefined { | ||
| // Set-Cookie: single cookie with attributes ("name=value; HttpOnly; Secure") | ||
| // Cookie: multiple cookies separated by "; " ("cookie1=value1; cookie2=value2") |
There was a problem hiding this comment.
m: The split is on '; ' (semicolon plus space), so a header without the space could still leak.
Cookie: theme=dark;__Secure-session=abc123
-> { 'http.request.header.cookie.theme': 'dark;__Secure-session=abc123' }
Could we use parseCookie and drop this function entirely? It seems to cover all the cases we need to support.
| // A non-empty string we cannot parse may still hold a session token, so it counts as sensitive. | ||
| if (Object.keys(parsed).length === 0) { | ||
| return {}; | ||
| return cookieString ? FILTERED : {}; |
There was a problem hiding this comment.
l: This might be a no-op, both httpclient.ts call sites check for an object
const filtered = _INTERNAL_filterCookies(reqCookieStr, dc.cookies);
if (typeof filtered === 'object') {
requestCookies = filtered;
}So it would be dropped rather than show up as [FILTERED], maybe we need to adjust those checks as well?
Two ways a sensitive value slipped past the denylist.
A
Cookiesegment without an=became the attribute key itself, so ifCookie: <opaque-token>shipped the token ashttp.request.header.cookie.<opaque-token>. Those segments are dropped now, and a header with nothing extractable falls back to[Filtered], which is the documented behaviour.Headers listed in
headersToSpanAttributesskipped the denylist entirely, soauthorizationwent out in the clear. The spec says an allowlist never exempts a sensitive name, so those are filtered too.Fixes #24085