S11.6: Dynamic import() in Page-Sandbox ausführen #67
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#67
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?
Problembeschreibung
import()in Page-Scripts läuft in Bun's globalem Scope, nicht in unserem sandboxedwith(_win)-Realm. Dadurch haben dynamic imports Zugriff auf Node-Globals.Aktuell:
Lösungsansatz
Option A:
import()via Proxy wrappen — die importierte URL in einen data:-URL mit unserem Realm prefix umleiten.Option B:
importalsvoid 0blocken (wierequire).Option C: Aus Module-Importe via
executeModule()in unserem Realm leiten.Entscheidung: Option A/B hybrid —
importalsvoid 0deklarieren für Sicherheit, plus Refactoring vonexecuteModule()für zukünftige Sandboxing.Akzeptanzkriterien
typeof import→"undefined"(wird geblockt)executeModule()laufen haben korrektenwith(_win)-ScopeBetroffene Dateien
src/js/execution-realm.tsvar import = void 0;src/js/execution-realm.tsexecuteModule()erhältwith(_win)-Scopetests/unit/sprint11-dynamic-import.test.tsRisiken
var importist ein reserviertes Wort → geht nicht (SyntaxError). Alternative:var _import = void 0;importals Property auf_winsetzen?_win.import = undefined;— dann viawith(_win)geblocktSuperseded by #71 — Sprint 15 implementiert Dynamic import() Sandbox mit var-Blockern und Export-Merging.