Skip to content

feat(cloudflare): Migrate to dataCollection#21237

Draft
chargome wants to merge 1 commit into
developfrom
cg/cloudflare-datacollection
Draft

feat(cloudflare): Migrate to dataCollection#21237
chargome wants to merge 1 commit into
developfrom
cg/cloudflare-datacollection

Conversation

@chargome
Copy link
Copy Markdown
Member

Migrates the Cloudflare SDK from sendDefaultPii to the new dataCollection spec.

  • sdk.ts: Remove sendDefaultPii-based conditional for requestDataIntegration. The integration now derives its include config fromclient.getDataCollectionOptions() internally.
  • request.ts: Pass client.getDataCollectionOptions() to httpHeadersToSpanAttributes instead of sendDefaultPii.
  • httpServer.ts: maxRequestBodySize no longer defaults to 'medium' — falls back to dataCollection.httpBodies (captures at 'medium' if 'incomingRequest' is listed, otherwise no capture). Integration-level option still takes precedence when explicitly set.

Fixes #20934

@chargome chargome self-assigned this May 29, 2026
requestDataIntegration(),
consoleIntegration(),
];
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auth and session cookies now captured in Sentry events by default after removing explicit cookie exclusion

Removing the explicit { include: { cookies: false } } guard from requestDataIntegration() causes all HTTP cookies — including session tokens, auth tokens, and CSRF cookies — to be captured in Sentry error events by default, because the new default dataCollection.cookies value ({ deny: PII_HEADER_SNIPPETS }) evaluates to true in the include.cookies check and the event path in extractNormalizedRequestData performs no further deny-list filtering.

Evidence
  • requestDataIntegration() (no options) calls resolveIncludeAndDataCollection(client) in packages/core/src/integrations/requestdata.ts.
  • With no dataCollection or sendDefaultPii set, client.getDataCollectionOptions() returns cookies: { deny: ['forwarded', '-ip', 'remote-', 'via', '-user'] } — patterns for IP headers, not cookie names.
  • include.cookies = dataCollection.cookies !== false evaluates to true because { deny: [...] } !== false.
  • extractNormalizedRequestData then unconditionally executes requestData.cookies = parseCookie(headers.cookie) when include.cookies is true, adding all cookies to event.request.cookies with no deny-list filtering.
  • Previously requestDataIntegration({ include: { cookies: false } }) short-circuited this path entirely; the SENSITIVE_COOKIE_NAME_SNIPPETS filtering only applies in the span/httpHeadersToSpanAttributes path, not in the event processing path.

Identified by Warden security-review · EBZ-JZ3

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.17 kB - -
@sentry/browser - with treeshaking flags 25.62 kB - -
@sentry/browser (incl. Tracing) 45.25 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.47 kB - -
@sentry/browser (incl. Tracing, Profiling) 50.22 kB - -
@sentry/browser (incl. Tracing, Replay) 84.83 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.39 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 89.53 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.15 kB - -
@sentry/browser (incl. Feedback) 44.34 kB - -
@sentry/browser (incl. sendFeedback) 31.98 kB - -
@sentry/browser (incl. FeedbackAsync) 37.08 kB - -
@sentry/browser (incl. Metrics) 28.25 kB - -
@sentry/browser (incl. Logs) 28.48 kB - -
@sentry/browser (incl. Metrics & Logs) 29.19 kB - -
@sentry/react 28.99 kB - -
@sentry/react (incl. Tracing) 47.51 kB - -
@sentry/vue 32.2 kB - -
@sentry/vue (incl. Tracing) 47.16 kB - -
@sentry/svelte 27.19 kB - -
CDN Bundle 29.55 kB - -
CDN Bundle (incl. Tracing) 47.81 kB - -
CDN Bundle (incl. Logs, Metrics) 31.05 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.04 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.31 kB - -
CDN Bundle (incl. Tracing, Replay) 85.18 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.35 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.05 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.21 kB - -
CDN Bundle - uncompressed 87.59 kB - -
CDN Bundle (incl. Tracing) - uncompressed 144.09 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 92.08 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 147.85 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 216.81 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 262.87 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 266.61 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 276.57 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 280.3 kB - -
@sentry/nextjs (client) 50.03 kB - -
@sentry/sveltekit (client) 45.68 kB - -
@sentry/core/server 75.93 kB - -
@sentry/core/browser 63.09 kB - -
@sentry/node-core 61.69 kB - -
@sentry/node 130.4 kB -0.01% -1 B 🔽
@sentry/node - without tracing 74.1 kB - -
@sentry/aws-serverless 86.29 kB - -
@sentry/cloudflare (withSentry) - minified 171.51 kB +0.02% +18 B 🔺
@sentry/cloudflare (withSentry) 429.15 kB -0.04% -141 B 🔽

View base workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(cloudflare): Migrate cloudflare to dataCollection

1 participant