Title: withSentry in nextjs can not be configured to scrub cookies (sensitive data) · Issue #4723 · getsentry/sentry-javascript · GitHub
Open Graph Title: withSentry in nextjs can not be configured to scrub cookies (sensitive data) · Issue #4723 · getsentry/sentry-javascript
X Title: withSentry in nextjs can not be configured to scrub cookies (sensitive data) · Issue #4723 · getsentry/sentry-javascript
Description: Problem Statement All I want is to scrub certain (or all) cookies from the events sent to Sentry. Basic data scrubbing of sensitive fields. The beforeSend hook is never called. Don't know why, but I saw in the code that the beforeSend ho...
Open Graph Description: Problem Statement All I want is to scrub certain (or all) cookies from the events sent to Sentry. Basic data scrubbing of sensitive fields. The beforeSend hook is never called. Don't know why, but ...
X Description: Problem Statement All I want is to scrub certain (or all) cookies from the events sent to Sentry. Basic data scrubbing of sensitive fields. The beforeSend hook is never called. Don't know why, ...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/4723
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"withSentry in nextjs can not be configured to scrub cookies (sensitive data)","articleBody":"### Problem Statement\r\n\r\nAll I want is to scrub certain (or all) cookies from the events sent to Sentry. Basic data scrubbing of sensitive fields.\r\n\r\nThe `beforeSend` hook is never called. Don't know why, but I saw in the code that the [`beforeSend` hook is not called when the event type is transaction](https://github.com/getsentry/sentry-javascript/blob/2d3b86122a618500b0c7a1d1017e1d561f789c1f/packages/core/src/baseclient.ts#L564-L568), and all events I see go through the sentry code are transactions.\r\n\r\nI'm using `withSentry` from the `@sentry/nextjs` package, which internally calls `parseRequest` that's responsible for extracting the relevant sensitive data from the request. The `parseRequest` function accepts (optional) options, that AFAICS can be used to limit what keys are extracted from the request ([defaults](https://github.com/getsentry/sentry-javascript/blob/2d3b86122a618500b0c7a1d1017e1d561f789c1f/packages/node/src/handlers.ts#L193) include cookies). The `withSentry` function however does not allow passing any options to `parseRequest`.\r\n\r\n### Solution Brainstorm\r\n\r\nAllow options to be passed to `withSentry` to allow it to override what keys are extracted by [`extractRequestData`](https://github.com/getsentry/sentry-javascript/blob/2d3b86122a618500b0c7a1d1017e1d561f789c1f/packages/node/src/handlers.ts#L203). The [`requestHandler`](https://github.com/getsentry/sentry-javascript/blob/2d3b86122a618500b0c7a1d1017e1d561f789c1f/packages/node/src/handlers.ts#L385-L387) function can be configured in such a way, for example.\r\n\r\nOr provide a hook that's called on /all/ events before they are sent to Sentry, not just some.","author":{"url":"https://github.com/wereHamster","@type":"Person","name":"wereHamster"},"datePublished":"2022-03-15T22:10:39Z","url":"https://github.com/getsentry/sentry-javascript/issues/4723"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:64b8f3b4-d786-75ee-595c-deb7ce9eb5de |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9520:24E34C:A2B525:E44153:6B042F92 |
| html-safe-nonce | cc07f968dc916a1e5259e59dc39f32528656f032eabed3ee5386a32fd69823b6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTIwOjI0RTM0QzpBMkI1MjU6RTQ0MTUzOjZCMDQyRjkyIiwidmlzaXRvcl9pZCI6IjM2MjgzMDA2ODYzODI5ODAwMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | bea73ab5badaecdc35ec3630f5651f464941a7a4f1cd06ae1cc7dcf74871f48b |
| hovercard-subject-tag | issue:1170315878 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/4723/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ccd21232396d730c0e20f90e42499f22975e96ba88a5a90d421b8d0d21667cae/getsentry/sentry-javascript/issues/4723 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ccd21232396d730c0e20f90e42499f22975e96ba88a5a90d421b8d0d21667cae/getsentry/sentry-javascript/issues/4723 |
| og:image:alt | Problem Statement All I want is to scrub certain (or all) cookies from the events sent to Sentry. Basic data scrubbing of sensitive fields. The beforeSend hook is never called. Don't know why, but ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | wereHamster |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width