Title: Baggage header propagation is dropping property values · Issue #17845 · getsentry/sentry-javascript · GitHub
Open Graph Title: Baggage header propagation is dropping property values · Issue #17845 · getsentry/sentry-javascript
X Title: Baggage header propagation is dropping property values · Issue #17845 · 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/17845
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Baggage header propagation is dropping property values","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\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/node\n\n### SDK Version\n\nlatest\n\n### Framework Version\n\n_No response_\n\n### Link to Sentry event\n\n_No response_\n\n### Reproduction Example/SDK Setup\n\ntest.js file\n\n```javascript\nconst Sentry = require('@sentry/node');\n\nSentry.init({\n dsn: 'https://public@sentry.example.com/1\"',\n // ...\n});\n\nconst http = require('http');\n\nconst options = {\n hostname: 'localhost',\n port: 8080,\n headers: {\n baggage: 'key1=value1;property1;property2, key2 = value2, key3=value3; propertyKey=propertyValue'\n }\n};\n\nhttp.get(options);\n```\n\n### Steps to Reproduce\n\nRequests containing a baggage header with property values sent from a nodejs app using sentry results in those baggage property values being dropped.\n\nExample baggage header (taken from [w3c spec](https://www.w3.org/TR/baggage/#example)):\n\n`baggage: key1=value1;property1;property2, key2 = value2, key3=value3; propertyKey=propertyValue`\n\nThe resulting baggage header is modified to:\n\n`baggage: key1=value1%3Bproperty1%3Bproperty2,key2=value2,key3=value3%3B%20propertyKey,sentry-environment=production,sentry-public_key=public,sentry-trace_id=3c04e02e27e644f2af89b05b02a1b120`\n\nThe metadata associated with `key3` has `=propertyValue` truncated.\n\n**Steps to recreate**\n\n```shell\nnc -l localhost 8080 & node test.js && wait\n\nGET / HTTP/1.1\nbaggage: key1=value1%3Bproperty1%3Bproperty2,key2=value2,key3=value3%3B%20propertyKey,sentry-environment=production,sentry-public_key=public,sentry-trace_id=3c04e02e27e644f2af89b05b02a1b120\nHost: localhost:8080\nsentry-trace: 3c04e02e27e644f2af89b05b02a1b120-98a5af2e203aec16\nConnection: keep-alive\n```\n\n### Expected Result\n\nThe baggage header preserves all metadata (incl properties) associated with a baggage key.\n\n`baggage: key1=value1%3Bproperty1%3Bproperty2,key2=value2,key3=value3%3B%20propertyKey%3DpropertyValue,sentry-environment=production,sentry-public_key=public,sentry-trace_id=3c04e02e27e644f2af89b05b02a1b120`\n\nor unencoded as\n`key1=value1;property1;property2,key2=value2,key3=value3; propertyKey=propertyValue,sentry-environment=production,sentry-public_key=public,sentry-trace_id=3c04e02e27e644f2af89b05b02a1b120`\n\n\n### Actual Result\n\nThe actual result is that the propertyValue metadata property value associated with key3 is lost:\n\n`baggage: key1=value1%3Bproperty1%3Bproperty2,key2=value2,key3=value3%3B%20propertyKey,sentry-environment=production,sentry-public_key=public,sentry-trace_id=3c04e02e27e644f2af89b05b02a1b120`\n\n### Additional Context\n\nAccording to the [W3C baggage spec](https://www.w3.org/TR/baggage/) parsers must adhere to the following.\n\n> Note, value MAY contain any number of the equal sign (U+003D) code points. Parsers **MUST NOT** assume that the equal sign is only used to separate key and value.\n\nProperty metadata description\n\n> Additional metadata MAY be appended to values in the form of property set, represented as semi-colon ; delimited list of keys and/or key-value pairs, e.g. ;k1=v1;k2;k3=v3. Property keys and values are given no specific meaning by this specification. Leading and trailing OWS is allowed and is not considered to be a part of the property key or value.\n\nhttps://www.w3.org/TR/baggage/#property\n\nTest cases from w3c baggage github.\n\n```python\n def test_parse_kv_property(self):\n entry = BaggageEntry.from_string(\n \"SomeKey=SomeValue;SomePropKey=SomePropValue\")\n self.assertEqual(entry.key, \"SomeKey\")\n self.assertEqual(entry.value, \"SomeValue\")\n self.assertEqual(len(entry.properties), 1)\n self.assertEqual(entry.properties[0].key, \"SomePropKey\")\n self.assertEqual(entry.properties[0].value, \"SomePropValue\")\n\n```\n\nhttps://github.com/w3c/baggage/blob/main/test/test_baggage.py#L151-L158\n\nIt appears the bug is located in this function:\n\nhttps://github.com/getsentry/sentry-javascript/blob/379b539c4a113a68a75301906458770bc8ae7422/packages/core/src/utils/baggage.ts#L113-L133\n\nThe `reduce` function is only taking the first two values after splitting on '='. This is problematic as any key metadata property value will be lost. A corrected function would look something like:\n\n```javascript\nfunction baggageHeaderToObject(baggageHeader) {\n return baggageHeader\n .split(',')\n .map(baggageEntry => {\n const eqIdx = baggageEntry.indexOf('=');\n if (eqIdx === -1) {\n return [];\n }\n const key = baggageEntry.slice(0, eqIdx);\n const value = baggageEntry.slice(eqIdx + 1);\n return [key, value].map(keyOrValue => {\n try {\n return decodeURIComponent(keyOrValue.trim());\n } catch {\n // We ignore errors here, e.g. if the value cannot be URL decoded.\n // This will then be skipped in the next step\n return;\n }\n });\n })\n .reduce((acc, [key, value]) => {\n if (key && value) {\n acc[key] = value;\n }\n return acc;\n }, {});\n}\n```\n\n\n\u003csub>Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it.\u003c/sub>","author":{"url":"https://github.com/zandt-square","@type":"Person","name":"zandt-square"},"datePublished":"2025-10-01T22:49:28Z","url":"https://github.com/getsentry/sentry-javascript/issues/17845"}
| 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:177e229b-e2e9-282e-323f-05d226c28608 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9EAE:3644F3:830547:ADDCFC:6B04ECE2 |
| html-safe-nonce | 715f0d95f17a6b7dec5538fef1932f0df436754671120258794c9d08c66be546 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RUFFOjM2NDRGMzo4MzA1NDc6QUREQ0ZDOjZCMDRFQ0UyIiwidmlzaXRvcl9pZCI6IjkxNjUwMzczOTM0MDQwMzAxNzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b65aa8004a3bf8668d0168adba81f0a2c131b19ac0fe09d035b8994e90e99821 |
| hovercard-subject-tag | issue:3475412059 |
| 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/17845/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2146240476d4be17c6e83b0e478b9bff0d13a8badb8ddc857281c7345a1863f8/getsentry/sentry-javascript/issues/17845 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2146240476d4be17c6e83b0e478b9bff0d13a8badb8ddc857281c7345a1863f8/getsentry/sentry-javascript/issues/17845 |
| 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 | zandt-square |
| hostname | github.com |
| expected-hostname | github.com |
| None | f3851aad500d8e8dce736722ddc6fa9596e17d9fce3c53581eba968664c0bc32 |
| 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 | e29c922455fd8137f27e1cfcdf6a1e8b920b1926 |
| 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