Conversation
size-limit report 📦
|
|
bugbot run |
Resolved conflicts in packages/core/src/utils/request.ts (kept develop's shouldFilterDataKey-based header filtering alongside the new body filter imports; filterKeyValueData import dropped as unused) and in the express tracing integration test (kept develop's span-streaming assertions with this branch's '[Filtered]' body expectations). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e93cb39. Configure here.
| function isFormBody(body: string): boolean { | ||
| return body.includes('=') && body.split('&').every(segment => FORM_SEGMENT_RE.test(segment)); | ||
| } |
There was a problem hiding this comment.
Bug: The isFormBody() function misidentifies XML with attributes as form-encoded, causing filterQueryParams() to corrupt the XML body when sensitive attribute names are present.
Severity: HIGH
Suggested Fix
Before applying form-body filtering, check the request's Content-Type header to ensure it is actually application/x-www-form-urlencoded. Alternatively, make the regex in isFormBody() stricter to avoid matching XML structures.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: packages/core/src/utils/data-collection/filterHttpBody.ts#L15-L17
Potential issue: The `isFormBody()` function incorrectly classifies XML bodies
containing attributes as form-encoded because it only checks for the presence of an `=`
character. This causes the XML string to be passed to `filterQueryParams()`. For an XML
body like `<config auth_token="secret">`, the function incorrectly identifies `<config
auth_token` as a parameter key. Since this "key" contains a sensitive substring
(`auth`), the entire body is incorrectly filtered and corrupted, resulting in `<config
auth_token=[Filtered]>`. This affects any XML request body with attributes whose names
contain sensitive keywords, leading to corrupted diagnostic data.
Did we get this right? 👍 / 👎 to inform future reviews.

Automatically captured HTTP request bodies went out raw, and the browser
graphqlClientattached GraphQL documents with inline literals intact.
Bodies now run through a filter at capture time, before truncation, since a truncated JSON
body no longer parses. JSON and form bodies keep their shape, and values of sensitive keys
become
[Filtered]. A body without key-value structure passes through unchanged: the SDKonly scrubs values it can attribute to a specific sensitive key, since Relay scrubs
server-side anyway and cannot tell an SDK-filtered value from a literal one. The browser
GraphQL document gets the same literal redaction the server-side integration applies to
the parsed AST.
The model follows OTel's sanitization of
db.query.text: keep the structure, replace the values.Relay scrubs as well, see this related PR: getsentry/sentry-conventions#625
Request bodies (
event.request.data/http.request.body.data)httpBodiesdefault (on)httpBodies: [](off){"colour":"blue","password":"hunter2"}{"colour":"blue","password":"[Filtered]"}colour=blue&access_token=abc123colour=blue&access_token=[Filtered]{"note":"xxx…...)"Not captured" means no attribute at all.
GraphQL document (
graphql.documenton span and breadcrumb)graphQL.documentdefault (on)document: false(off)query { user(email: "jane@example.com", age: 42) { name } }query { user(email: "*", age: *) { name } }query GetUser($id: ID!) { user(id: $id) { name } }Part of #24081