normalize() throws when a getter throws a Symbol or a null-prototype object
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, node.js, typescript
Direzione di ricerca
Leggi packages/core/src/utils/normalize.ts, concentrandoti sui blocchi catch di normalize e stringifyValue. Riproduci il problema con i tre esempi di getter nell’issue e verifica se i valori intercettati che sono Symbols o oggetti senza prototipo continuano a propagarsi come eccezioni. Il lavoro è terminato quando tutti i casi restituiscono un marcatore non serializzabile senza generare eccezioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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/getsentry/sentry-javascript/releases
How do you use Sentry?
Not applicable. The reproduction calls normalize from @sentry/core directly, without a DSN.
Which SDK are you using?
@sentry/core (the normalize utility that every SDK uses)
SDK Version
11.10.0
Steps to Reproduce
Node.js 24.21.0:
const { normalize } = require('@sentry/core')
const throwsError = { get x() { throw new Error('getter failed') } }
const throwsSymbol = { get x() { throw Symbol('s') } }
const throwsNullProto = { get x() { throw Object.create(null) } }
normalize({ bad: throwsError }, 3)
normalize({ bad: throwsSymbol }, 3)
normalize({ bad: throwsNullProto }, 3)
Expected Result
normalize returns the **non-serializable** marker for all three, as its JSDoc states: "returns A normalized version of the object, or "**non-serializable**" if any errors are thrown during normalization."
Actual Result
{ ERROR: '**non-serializable** (Error: getter failed)' }
TypeError: Cannot convert a Symbol value to a string
TypeError: Cannot convert object to primitive value
The second and third calls throw out of normalize.
Additional Context
Both catch blocks in packages/core/src/utils/normalize.ts (in normalize and in stringifyValue) build the marker with a template literal, `**non-serializable** (${err})`. The template literal converts the caught value to a string. That conversion throws for a Symbol and for an object without a usable toString or Symbol.toPrimitive. The current develop branch has the same code. A conversion that cannot throw, with a fixed fallback text, would keep normalize total.
- Lingua principale
- TypeScript
- Stelle
- 8.8k
- Fork
- 1.9k
- Merge medio
- 1g 19h
- PR unite (30g)
- 664
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di getsentry/sentry-javascript
-
Bug Node.js
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
getsentry/sentry-javascript#25950 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Browser Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
getsentry/sentry-javascript#25946 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Only create Nuxt database and storage spans when there is a parent spanForse già presa @nicohrubec l’ha presa 5 giorni fa. ApertaImprovement Nuxt
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
getsentry/sentry-javascript#25805 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Only create Cloudflare storage and D1 db spans when there is a parent spanForse già presa @nicohrubec l’ha presa 5 giorni fa. ApertaCloudflare Workers Improvement Spans
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
getsentry/sentry-javascript#25804 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Only create aws-sdk DynamoDB db spans when there is a parent spanForse già presa @nicohrubec l’ha presa 5 giorni fa. ApertaBug javascript
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
getsentry/sentry-javascript#25801 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di getsentry/sentry-javascript
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
bug needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
DSpace/dspace-angular#6511 ·
I maintainer di solito rispondono entro 1 giorno
-
area: frontend area:byok bug severity:low
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Phone app shows Unknown for a remote machine whose key changedForse già presa @janicduplessis l’ha presa oggi. Apertaarea: mobile priority: P3 type: bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
appandflow/stim#5006 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Area - Local to Cloud Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
microsoft/vscode-mssql#23209 ·
I maintainer di solito rispondono entro 1 giorno