Title: `EventScrubber` doesn't scrub a request body that's a top level JSON array · Issue #7543 · getsentry/sentry-python · GitHub
Open Graph Title: `EventScrubber` doesn't scrub a request body that's a top level JSON array · Issue #7543 · getsentry/sentry-python
X Title: `EventScrubber` doesn't scrub a request body that's a top level JSON array · Issue #7543 · getsentry/sentry-python
Description: How do you use Sentry? Sentry Saas (sentry.io) Version 2.69.2 (also on master at 494ecb3) Steps to Reproduce When a request body parses to a top level JSON array, nothing in it gets scrubbed. The same secrets in an object body are filter...
Open Graph Description: How do you use Sentry? Sentry Saas (sentry.io) Version 2.69.2 (also on master at 494ecb3) Steps to Reproduce When a request body parses to a top level JSON array, nothing in it gets scrubbed. The s...
X Description: How do you use Sentry? Sentry Saas (sentry.io) Version 2.69.2 (also on master at 494ecb3) Steps to Reproduce When a request body parses to a top level JSON array, nothing in it gets scrubbed. The s...
Opengraph URL: https://github.com/getsentry/sentry-python/issues/7543
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`EventScrubber` doesn't scrub a request body that's a top level JSON array","articleBody":"### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Version\n\n2.69.2 (also on master at 494ecb3)\n\n### Steps to Reproduce\n\nWhen a request body parses to a top level JSON array, nothing in it gets scrubbed. The same secrets in an object body are filtered normally. No `event_scrubber` argument, no `_experiments` data collection config, default `max_request_body_size`. The integration and the transport in the snippet are only there to catch the event.\n\nA top level array is the usual shape for a bulk endpoint, something like `POST /api/v1/users/bulk` with a list of records. If those records carry a password or an `api_key`, they leave the process in the clear. A team that spot checks a single object endpoint sees scrubbing work fine, so there's nothing to tip them off.\n\nPython 3.13.15, Flask 3.1.3, `sentry-sdk` 2.69.2. Save this as `repro.py` and run it.\n\n```python\nimport json\nimport logging\n\nimport sentry_sdk\nfrom flask import Flask\nfrom sentry_sdk.integrations.flask import FlaskIntegration\n\nevents = []\n\n\nclass Capture(sentry_sdk.transport.Transport):\n def capture_envelope(self, envelope):\n for item in envelope.items:\n if item.headers.get(\"type\") == \"event\":\n events.append(item.payload.json)\n\n\nsentry_sdk.init(\n dsn=\"https://public@example.com/1\",\n integrations=[FlaskIntegration()],\n transport=Capture(),\n)\n\napp = Flask(__name__)\napp.logger.disabled = True\nlogging.getLogger(\"werkzeug\").disabled = True\n\n\n@app.route(\"/bulk\", methods=[\"POST\"])\ndef bulk():\n raise ValueError(\"boom\")\n\n\n@app.route(\"/single\", methods=[\"POST\"])\ndef single():\n raise ValueError(\"boom\")\n\n\nclient = app.test_client()\nclient.post(\"/bulk\", json=[{\"user\": \"a\", \"password\": \"hunter2\"}])\nclient.post(\"/single\", json={\"user\": \"a\", \"password\": \"hunter2\"})\nsentry_sdk.get_client().close()\n\nprint(\"array body :\", json.dumps(events[0][\"request\"][\"data\"]))\nprint(\"object body:\", json.dumps(events[1][\"request\"][\"data\"]))\n```\n\n### Expected Result\n\nThe array body should come out filtered the same way the object body does:\n\n```\narray body : [{\"password\": \"[Filtered]\", \"user\": \"a\"}]\nobject body: {\"password\": \"[Filtered]\", \"user\": \"a\"}\n```\n\n### Actual Result\n\n```\narray body : [{\"password\": \"hunter2\", \"user\": \"a\"}]\nobject body: {\"password\": \"[Filtered]\", \"user\": \"a\"}\n```\n\n`EventScrubber.scrub_request` calls `scrub_dict` on `event[\"request\"][\"data\"]`, and `scrub_dict` returns immediately when what it's given isn't a dict, so a list body stops scrubbing before it starts. The class already ships `scrub_list`, whose docstring says it walks a list and any nested lists and calls `scrub_dict` on every dictionary it finds, but it's never called on the request body.\n\nThis is separate from #7542, which is about how denylist keys are matched. Here the keys never get looked at at all. I have a fix and tests ready if you want a PR.\n","author":{"url":"https://github.com/Om-singhaI","@type":"Person","name":"Om-singhaI"},"datePublished":"2026-09-20T03:51:19Z","url":"https://github.com/getsentry/sentry-python/issues/7543"}
| 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:24a20ec6-7ea0-c783-3a37-950bf116fd24 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8C52:81DA9:7A8041:A7FDA2:6B009D97 |
| html-safe-nonce | 61b6509862983216420ab01f2bde2463ca1f7d195b60062e9073fa098ef521b7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QzUyOjgxREE5OjdBODA0MTpBN0ZEQTI6NkIwMDlEOTciLCJ2aXNpdG9yX2lkIjoiNTg2NDEyNTMzMTU3Njc1NzY1NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 28f857ee08f119231b1421d0e49a036f75ae29386735e99c2e7977d28dc45eb0 |
| hovercard-subject-tag | issue:5515609242 |
| 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-python/7543/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bdfc641d58e93b8f912d08c676c014ec73a02ea42c539dbed823b797fdb41540/getsentry/sentry-python/issues/7543 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bdfc641d58e93b8f912d08c676c014ec73a02ea42c539dbed823b797fdb41540/getsentry/sentry-python/issues/7543 |
| og:image:alt | How do you use Sentry? Sentry Saas (sentry.io) Version 2.69.2 (also on master at 494ecb3) Steps to Reproduce When a request body parses to a top level JSON array, nothing in it gets scrubbed. The s... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Om-singhaI |
| hostname | github.com |
| expected-hostname | github.com |
| None | 52c95ce7e48016ae14399656b4ee812462b6f1fa28c5008c8394da64794c00b8 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 137814779 |
| octolytics-dimension-repository_nwo | getsentry/sentry-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 137814779 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-python |
| 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 | 1c9ddec8215f9a94e295c8310c3579b9c54ba31a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width