Title: Console breadcrumb serialization invokes getters & DOM traversal on logged objects (regression in 10.55.0: safeJoin now uses stringifyValue instead of String) · Issue #21353 · getsentry/sentry-javascript · GitHub
Open Graph Title: Console breadcrumb serialization invokes getters & DOM traversal on logged objects (regression in 10.55.0: safeJoin now uses stringifyValue instead of String) · Issue #21353 · getsentry/sentry-javascript
X Title: Console breadcrumb serialization invokes getters & DOM traversal on logged objects (regression in 10.55.0: safeJoin now uses stringifyValue instead of String) · Issue #21353 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have searched the existing issues (no match for safeJoin / stringifyValue / console-breadcrumb getter side effects) I have reviewed the documentation I am using the latest SDK release (reproduces on...
Open Graph Description: Is there an existing issue for this? I have searched the existing issues (no match for safeJoin / stringifyValue / console-breadcrumb getter side effects) I have reviewed the documentation I am usi...
X Description: Is there an existing issue for this? I have searched the existing issues (no match for safeJoin / stringifyValue / console-breadcrumb getter side effects) I have reviewed the documentation I am usi...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/21353
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Console breadcrumb serialization invokes getters & DOM traversal on logged objects (regression in 10.55.0: safeJoin now uses stringifyValue instead of String)","articleBody":"### Is there an existing issue for this?\n\n- [x] I have searched the existing issues (no match for `safeJoin` / `stringifyValue` / console-breadcrumb getter side effects)\n- [x] I have reviewed the documentation\n- [x] I am using the latest SDK release (reproduces on `10.56.0`)\n\n### How do you use Sentry?\n\nSentry SaaS (sentry.io)\n\n### Which SDK are you using?\n\n`@sentry/browser` (root cause is in `@sentry/core`'s `safeJoin`, surfaced via the Breadcrumbs integration; observed through `@sentry/nuxt`)\n\n### SDK Version\n\n10.56.0 (regression introduced in 10.55.0; last unaffected version: 10.54.0)\n\n### Framework Version\n\nNuxt 4 / Vue 3.5\n\n### Reproduction Example/SDK Setup\n\n```js\nimport * as Sentry from '@sentry/browser'\n\n// Default integrations include Breadcrumbs with console capturing enabled\nSentry.init({ dsn: '__YOUR_DSN__' })\n\nconst el = document.createElement('div')\nlet getterInvoked = false\nObject.defineProperty(el, 'id', {\n get() {\n getterInvoked = true // any side effect here now runs during console breadcrumb capture\n return ''\n },\n})\n\nconsole.log(el) // Sentry's console breadcrumb handler serializes the args here\nqueueMicrotask(() => console.warn('getter invoked by Sentry serialization?', getterInvoked))\n// @sentry/core \u003c= 10.54.0 -> false\n// @sentry/core >= 10.55.0 -> true (incl. 10.56.0)\n```\n\n### Steps to Reproduce\n\n1. Initialize any browser SDK with default integrations (Breadcrumbs `console: true`).\n2. `console.log()` an object that has a property **getter** (e.g. a DOM element, or any object with `Object.defineProperty(..., { get })`).\n3. Observe that the getter is **executed synchronously** as part of breadcrumb creation — even when DevTools is closed and no event is sent.\n\n### Expected Result\n\nCapturing a console breadcrumb should be **side-effect free**: serializing the logged arguments for the breadcrumb `message` must not invoke user-defined property getters, nor traverse the DOM. (`\u003c= 10.54.0` behaved this way — non-primitive args were serialized with `String(value)`.)\n\n### Actual Result\n\nGetters are invoked and DOM elements are walked during breadcrumb serialization.\n\nRoot cause — `@sentry/core` `safeJoin` (`packages/core/src/utils/string.ts`), which the Breadcrumbs integration uses for the console breadcrumb `message` (`message: safeJoin(handlerData.args, ' ')` in `_getConsoleBreadcrumbHandler`):\n\n```diff\n // \u003c= 10.54.0\n- } else {\n- output.push(String(value)); // \"[object HTMLDivElement]\" — no getters invoked\n- }\n\n // >= 10.55.0\n+ } else if (value instanceof Error) {\n+ output.push(value.message ? `${value.name}: ${value.message}` : value.name);\n+ } else {\n+ output.push(stringifyValue(void 0, value)); // \u003c- invokes getters\n+ }\n```\n\nFor DOM elements, `stringifyValue` resolves to `htmlTreeAsString` → `_htmlElementAsString` (`packages/core/src/utils/browser.ts`), which reads `elem.id` / `elem.className` / `elem.getAttribute(...)` and walks the ancestor chain — executing getters and adding DOM-traversal cost to every `console.log(element)`.\n\n### Additional Context\n\n- **Real-world impact (how we found it):** an anti-DevTools library uses the classic trap `Object.defineProperty(div, 'id', { get() { /* assume DevTools open */ } })` followed by `console.log(div)`, expecting the getter to fire only when DevTools renders the object. After upgrading `@sentry/nuxt` `10.53.1 → 10.55.0`, Sentry's breadcrumb serialization began invoking that `id` getter on every page, causing a false \"DevTools open\" detection (and a forced redirect) **with DevTools closed**. We confirmed via a pristine (un-instrumented) iframe `console.log` that the getter is read **only** through the main-window Sentry-instrumented console.\n- **Precedent that this class of bug is known/dangerous:** `safeJoin` already special-cases `isVueViewModel` to avoid serialization side effects (the infinite console-warning loop fixed in #8981). Invoking arbitrary getters / DOM traversal is the same category of risk (side effects, performance, potential exceptions).\n- **Affected range:** `10.55.0` … `10.56.0` (latest). `10.54.0` and earlier are unaffected.\n- **Suggestion:** keep breadcrumb-message serialization side-effect-free for non-primitive args (e.g. retain `String(value)` for the human-readable `message`, since the structured `data.arguments` already carries the raw args for later normalization), or guard `stringifyValue`/`htmlTreeAsString` against invoking getters during breadcrumb capture.\n\n### Priority\n\n\u003csub>React with 👍 to help prioritize this issue.\u003c/sub>\n","author":{"url":"https://github.com/KIM-DONGJU","@type":"Person","name":"KIM-DONGJU"},"datePublished":"2026-06-06T08:57:51Z","url":"https://github.com/getsentry/sentry-javascript/issues/21353"}
| 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:ceba3100-649b-84fa-5c59-c964ceee3990 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D092:1A4796:41F572:5CE526:6B047069 |
| html-safe-nonce | 9980a9e221b15fed29511dbf8930f23938e976a04a1504a3336beba1641fc2cc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDkyOjFBNDc5Njo0MUY1NzI6NUNFNTI2OjZCMDQ3MDY5IiwidmlzaXRvcl9pZCI6IjE5MDA5ODYwMzYzMzk4OTY0MjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d97a89d4a8bdee579f0d910026130b25f5b2cbf0bf1fc2b69dbb5fed780b48cc |
| hovercard-subject-tag | issue:4602703931 |
| 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/21353/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f80bd3b9543d294039277b3807d8f62eb6b7788ab491740446ae9c7acca3546a/getsentry/sentry-javascript/issues/21353 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f80bd3b9543d294039277b3807d8f62eb6b7788ab491740446ae9c7acca3546a/getsentry/sentry-javascript/issues/21353 |
| og:image:alt | Is there an existing issue for this? I have searched the existing issues (no match for safeJoin / stringifyValue / console-breadcrumb getter side effects) I have reviewed the documentation I am usi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | KIM-DONGJU |
| hostname | github.com |
| expected-hostname | github.com |
| None | ae8802492f12d3ba4f6b0d814054e617a2a5616b6327bf8555c10cd5b0dc2a6f |
| 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 | cfb5f24c6e01d85f70804652a5107e5cac03a161 |
| 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