Title: Cookies are being sent in an error-report by default in Express app · Issue #5458 · getsentry/sentry-javascript · GitHub
Open Graph Title: Cookies are being sent in an error-report by default in Express app · Issue #5458 · getsentry/sentry-javascript
X Title: Cookies are being sent in an error-report by default in Express app · Issue #5458 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/5458
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cookies are being sent in an error-report by default in Express app","articleBody":"### Is there an existing issue for this?\n\n- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [X] I have reviewed the documentation https://docs.sentry.io/\n- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSelf-hosted/on-premise\n\n### Which package are you using?\n\n@sentry/node\n\n### SDK Version\n\n7.7.0\n\n### Framework Version\n\n7.7.0\n\n### Link to Sentry event\n\n_No response_\n\n### Steps to Reproduce\n\nUsing `@sentry/node`, `Sentry.Handlers.requestHandler` does not clean up cookie sent in the headers, from express-based app by default. \r\n\r\nWe are using a React-app with express-server dealing with SSR. \r\nIn case of SSR-errors, @sentry/node is being used for handling errors. \r\nAccording to documentation, passing this options object: `{ request: ['headers', 'method', 'query_string', 'url'] }` in `Sentry.Handlers.requestHandler`, will NOT include cookies into the payload with an error-event sent to Sentry. \r\nIn our case it does and Sentry parses it as if we would actually pass the 'cookies' key into the options.request array. \r\n\r\nHere is code to reproduce this in a basic express-app:\r\n```JS\r\nconst Sentry = require('@sentry/node');\r\nconst app = require('express')();\r\nconst port = 3000;\r\n\r\nSentry.init({\r\n dsn: DSN_KEY,\r\n autoSessionTracking: false,\r\n release: RELEASE,\r\n beforeSend(event) {\r\n console.log(event); // Will have cookie prop in the headers. \r\n },\r\n});\r\n\r\napp.use(Sentry.Handlers.requestHandler({\r\n request: ['headers', 'method', 'query_string', 'url'],\r\n}));\r\n\r\napp.get('/', (req, res) => {\r\n throw new Error('pep, an error');\r\n res.send('Hello World!');\r\n});\r\n\r\napp.use(Sentry.Handlers.errorHandler({\r\n shouldHandleError() {\r\n return true;\r\n },\r\n}));\r\n\r\napp.listen(port, () => {\r\n console.log(`Example app listening on port ${port}`);\r\n});\r\n\r\n```\n\n### Expected Result\n\n Not passing 'cookies' key in the `options.request` array will clean up cookies from headers. \n\n### Actual Result\n\nWhile not passing `cookies` key in the `options.request` we still get cookies in the reports, being sent to Sentry. ","author":{"url":"https://github.com/ozerovs","@type":"Person","name":"ozerovs"},"datePublished":"2022-07-25T12:16:14Z","url":"https://github.com/getsentry/sentry-javascript/issues/5458"}
| 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:2719de2d-9aeb-a9b7-1bd7-5f2519daa402 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D4DA:9F9AF:1D5F5E:27BAB9:6B04388E |
| html-safe-nonce | b44f0d778827ffb003409938201fbe5ba245926106ce73e1834e496c310fe7f6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENERBOjlGOUFGOjFENUY1RToyN0JBQjk6NkIwNDM4OEUiLCJ2aXNpdG9yX2lkIjoiNDk0NzIyMTczNzQwMzMzMjc1MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d5e28b4b9df56c73dbe01a8dff83442dafe3431d8913ae332e527e4720217345 |
| hovercard-subject-tag | issue:1316751785 |
| 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/5458/issue_layout |
| twitter:image | https://opengraph.githubassets.com/aec9aafcf02ebfdb5e2bafc79be789a4bb8d30d6c5c7636338c706005af54102/getsentry/sentry-javascript/issues/5458 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/aec9aafcf02ebfdb5e2bafc79be789a4bb8d30d6c5c7636338c706005af54102/getsentry/sentry-javascript/issues/5458 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ozerovs |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9185ccfefd80c1ff2d9ddcdb0cd2becf46b5a1efbbf30741a895e4bb8de25e64 |
| 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 | 06dc448a76fe4751ac1db26524aefa3aa3e889a8 |
| 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