Plugin support: Sicherheit – Plugins laufen mit vollen Editor-Rechten #115

Open
opened 2026-09-17 17:57:04 +02:00 by meleki · 0 comments
Owner

Aus #113, Entscheidung 6: für v1 hingenommen, hier festgehalten.

Befund:

  • Ein Plugin ist JavaScript im selben Kontext wie der Editor. Es kann alles, was der Editor kann: die PHP-API aufrufen (Projekte, Texturen, Sounds lesen, überschreiben, löschen), das DOM und den gesamten Zustand im Speicher anfassen, beliebige Requests an fremde Server schicken.
  • Die api-Grenze aus #113 ist eine Bequemlichkeit, keine Schutzgrenze.
  • Eine iframe-Sandbox verträgt sich nicht mit dem einen WebGL-Canvas (Pixi darf nur einmal existieren).
  • Tragbar solange nur, wer Dateien auf den Server legen kann, Plugins installiert. Mit dem Upload (#116) ändert sich das: wer hochladen darf, darf faktisch alles.

Zu klären, bevor der Upload kommt:

  • Wer darf hochladen und aktivieren (nur Admins)?
  • Deutlicher Hinweis beim Aktivieren („läuft mit vollen Rechten“).
  • Varianten mit echter Grenze prüfen und bewerten, z. B. Plugin im Web Worker mit Message-API, UI nur deklarativ beschrieben und vom Editor gezeichnet – samt dem, was das an der API aus #113 ändern würde.
  • Serverseitig: Auslieferung nur aus data/plugins/, Dateinamen prüfen (in #113 schon Pflicht).
Aus #113, Entscheidung 6: für v1 hingenommen, hier festgehalten. **Befund:** - Ein Plugin ist JavaScript im selben Kontext wie der Editor. Es kann alles, was der Editor kann: die PHP-API aufrufen (Projekte, Texturen, Sounds lesen, überschreiben, löschen), das DOM und den gesamten Zustand im Speicher anfassen, beliebige Requests an fremde Server schicken. - Die `api`-Grenze aus #113 ist eine Bequemlichkeit, **keine Schutzgrenze**. - Eine iframe-Sandbox verträgt sich nicht mit dem einen WebGL-Canvas (Pixi darf nur einmal existieren). - Tragbar solange nur, wer Dateien auf den Server legen kann, Plugins installiert. Mit dem Upload (#116) ändert sich das: wer hochladen darf, darf faktisch alles. **Zu klären, bevor der Upload kommt:** - Wer darf hochladen und aktivieren (nur Admins)? - Deutlicher Hinweis beim Aktivieren („läuft mit vollen Rechten“). - Varianten mit echter Grenze prüfen und bewerten, z. B. Plugin im Web Worker mit Message-API, UI nur deklarativ beschrieben und vom Editor gezeichnet – samt dem, was das an der API aus #113 ändern würde. - Serverseitig: Auslieferung nur aus `data/plugins/`, Dateinamen prüfen (in #113 schon Pflicht).
admin added this to the Development project 2026-09-17 18:32:35 +02:00
admin moved this to Held back in Development on 2026-09-17 20:37:54 +02:00
admin added the held-back label 2026-09-17 20:37:59 +02:00
meleki referenced this issue from a commit 2026-09-20 14:24:29 +02:00
Plugins belong to the project, and they load before it: the project file gained the field plugins: ["demo-plugin.js"] (default empty, no formatVersion bump), the Plugins tab's switch writes into it as an ordinary undo step (SetPluginActiveCommand) instead of into a server-wide plugins.json, and the start order is turned around - startPlugins only fetches the list of files, then editor.boot() runs and ProjectStore.load(id, prepare) hands the raw JSON through before it is deserialized, where pluginsOf(raw) reads the list and PluginManager.syncTo() activates exactly those; that is the point of the issue, because what a plugin registers has to stand there before normalizeGraph would throw it away as unknown (#126, #127), a project switch first stops what the new project does not name and then starts what it does, a file the server does not have is passed over silently, and after signing out the manager is dead so a late event cannot start anything in a torn-down session; on the server plugins.json, PluginStore::setActive, isActive, the route PUT ?r=plugins/{file} and the 403 for inactive modules are gone and GET ?r=plugins only answers {file,bytes,updatedAt}, which makes every plugin file fetchable - the consequence accepted in #117, written down in the wiki for #115 and #116; publishPlugins(root) only copies files now, the seeder switches the demo plugin on in the fixture project, and the Plugins tab carries a puzzle piece as its icon while only a plugin's own tab still goes without one (the knob and the socket are cubic curves, not arcs, which Pixi's parser draws as a spike after an L); 3 new e2e checks in module 38 and 5 new unit tests cover the project as the owner of the switch, its undo, the order, pluginsOf against crude input and an unknown file name (#119)
admin added the question label 2026-09-21 08:05:07 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: meleki/feuerwerk#115