mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2945] [Issue]: Importing an extension runs its code immediately, with no confirmation #1521
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1521
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?
Originally created by @kolacheee on GitHub (Jun 28, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2945
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
When you import an extension, it lands enabled and starts running immediately. Enabled extensions execute their JavaScript in the app's own page (the same context as your saved API keys, your chats, and your session), so importing a
.js/.css/folder/zip from someone else runs their code the instant the file is read. The user only chose to import the file — they never got a chance to look at it, and there's no "this will run code, are you sure?" step. The Extensions UI also nudges people toward downloading community extensions, so importing an untrusted file is the expected flow.This isn't about extensions running arbitrary code in general — that's an accepted design choice. The fixable gap is that there's no boundary between "imported" and "running." Importing should stage the extension; enabling it should be the deliberate, confirmed step.
How to reproduce (try it yourself)
hello.jscontaining just:hello.js.You'll see: a toast
Extension "hello" installed, and the request toattacker.examplefire right away — no confirmation dialog, no preview. The same happens for a single.cssfile, a loose folder of.js/.cssfiles, and a.zipwhose manifest doesn't specifyenabled.Expected: an imported extension lands disabled, and turning it on (especially one with JS) asks for an explicit confirmation first.
(Note on reach: the extension write routes are gated to loopback/admin, so a purely remote attacker can't push this — it needs the victim to import an attacker-supplied file locally. That's a realistic social-engineering vector for a "try my cool extension" file, which is exactly how these get shared.)
Where it is
All four import paths default
enabledtotrue:packages/client/src/components/panels/SettingsPanel.tsx:4045—.jsimport:enabled: trueSettingsPanel.tsx:4060—.cssimport:enabled: trueSettingsPanel.tsx:3883—createLooseExtensionFolderImportEntries:enabled: trueSettingsPanel.tsx:3859—normalizeExtensionImportEntry:enabled: typeof record.enabled === "boolean" ? record.enabled : true(a manifest missing the flag → enabled)The execution sink is
packages/client/src/components/layout/CustomThemeInjector.tsx—buildExtensionModuleSource(28-43) →new Blob(249) →URL.createObjectURL(250) →import()(252), which runs on the next render for any enabled extension.What's happening
Every import code path enables the extension by default, and the injector runs any enabled extension's JS automatically. There is no staging step, no review, and no confirmation between dropping in a file and executing its code.
Suggested fix
Default imported extensions to
enabled: falsein all four spots (the two hardcoded literals, the loose-folder builder, and the normalizer's missing-flag fallback) — keepenabled: trueonly when a round-tripped manifest explicitly carried it. Then gate the first enable of a JS extension behind a confirmation dialog with a clear "this runs code in the app" warning.showConfirmDialogis already imported and used elsewhere inSettingsPanel.tsx.AI-investigated against v2.0.6; all cited lines were read and the repro verified. Please confirm before fixing.
@SpicyMarinara commented on GitHub (Jun 28, 2026):
Fixed on staging: imported extension files/folders now stage disabled for review by default, and enabling JavaScript extensions requires an explicit confirmation.