narrowView's extra check uses 'prop in extra', reaching Object.prototype ahead of the guarded-field copy

Aperta
#2,050 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript
Ambito
backend

Direzione di ricerca

Read src/core/runtime/activation.js around lines 1146-1156, where answers() and read() check extra before the guarded fields. Add an own-property check for extra and tests showing a guarded field named after an Object.prototype member still returns a frozen copy. Record a decision for what String(view) should do after the change.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Source: #2042 at f77424adc609d7e01d9c90304bfe63b3213b5d04
Location: src/core/runtime/activation.js:1146 and :1150
Severity: minor

Evidence

Verified at f77424ad: answers() tests 'prop in extra' (:1146) and read() tests 'key in extra' (:1150), and both call sites pass extra as a plain object literal, so inherited Object.prototype names (toString, constructor, proto) answer through the extra branch. That branch sits ahead of the guarded check at :1153-1156. No live bypass exists: the guarded names are inputSchema, aliases, and supports, none of which is an Object.prototype member.

Why deferral is safe

No incorrect behavior with a consequence today, so this is hardening against a future guarded field whose name collides with an Object.prototype member (for example constructor), which would be served from extra and silently skip the frozen copy. Pre-existing structure (the old code gave extra the same precedence over the supports branch). The one-word fix, Object.hasOwn(extra, prop), also changes String(view) from '[object Object]' to a throw, which is more than PR 2042 should carry.

Acceptance condition

answers/read use an own-property check (Object.hasOwn) for extra, with a test showing a guarded field named after an Object.prototype member still answers with a frozen copy, and a decision recorded for what String(view) should do afterwards.

Review preference; backlog only. A human may explicitly delegate it with neutral:fix.

Lingua principale
JavaScript
Stelle
11
Fork
0
Merge medio
2h 55m
PR unite (30g)
294

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hyparam/hypaware

Tutte le issue di hyparam/hypaware

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.