Indirect eval (0, eval)() Escape — Known Limitation (unfixable per JS Spec) #70
Labels
No labels
bug
docs
feature
housekeeping
html-spec
performance
react-compat
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
glow-all/true-headless-browser#70
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Indirect eval
(0, eval)()Escape — Known LimitationProblembeschreibung
(0, eval)("typeof Bun")(indirect eval) läuft per JavaScript-Spezifikation IMMER im globalen Scope, unabhängig vonwith()-Blöcken, Closure-Scopes oder Proxy-Tricks. Das ist ein fundamentaler Sprachmechanismus der nicht überschrieben oder abgefangen werden kann.Warum ist das nicht fixbar?
evalin(0, eval)ist eine indirekte Referenz — der0-Trick erzwingt globalen Scopewith(_win)-Block hat KEINE Kontrolle über indirect eval — das ist JS-Spec, Section 18.2.1_win.evalüberschreiben:(0, eval)nutzt den ORIGINALENevalaus dem globalen RealmImpact
(0, eval)()— das ist ein Pattern für JavaScript-Compiler/Optimizer-Toolsthisoderselfzur globalen Detektion, nicht indirect eval(0, eval)aufrufen können, haben sie schon andere Wege (XSS)Akzeptanzkriterien
sprint14odersprint11dokumentiert den EscapeBetroffene Dateien
tests/unit/sprint11-script-security.test.ts(0, eval) escaped den with(_win)-ScopeStand: Hinzunehmende Limitation
`(0, eval)()`` escape ist ein JS-Spec-Problem, kein Bug. Chromium hat das gleiche Verhalten.
CSP-Phase 7 (#103, completed) hat
unsafe-evalSandbox-Patching eingeführt: window.eval wird bei fehlendemunsafe-evaldurch eine throwing-Funktion ersetzt. Das blockt direkte eval()-Aufrufe, aber(0, eval)()ist per JS Spec nicht blockbar (ruft eval im globalen Scope auf, nicht im window-Scope).Aktuelle Mitigation:
'unsafe-eval'in CSP-Policy erlauben, wenn die Seite eval-basierte Frameworks nutzt.