mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #2536] [MERGED] fix(extensions): gate install/update/delete behind requirePrivilegedAccess #5639
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#5639
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?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2536
Author: @Romuromylus
Created: 6/9/2026
Status: ✅ Merged
Merged: 6/9/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/extensions-privileged-gate📝 Commits (2)
0629202fix(extensions): gate install/update/delete behind requirePrivilegedAccess553c7b6Merge branch 'staging' into fix/extensions-privileged-gate📊 Changes
1 file changed (+5 additions, -1 deletions)
View changed files
📝
packages/server/src/routes/extensions.routes.ts(+5 -1)📄 Description
Linked issue
Closes #2529
Why this change
The
/api/extensionsmutating handlers (POST/PATCH/DELETE) carried only the app-global basic-auth + CSRFonRequesthooks and never calledrequirePrivilegedAccess, which the sibling/api/custom-toolsroute applies to each of its mutating handlers. An installed extension'sjsis built into a blob-URL ES module and auto-import()ed with full DOM/window access by the client loader (CustomThemeInjector.tsx) wheneverenabled === true. So the extensions route creates the more dangerous artifact yet was the lone CRUD route skipping the gate — on a shared-credential basic-auth deployment a lower-trust authenticated user could install persistent self-executing JS without the admin secret.What changed
packages/server/src/routes/extensions.routes.ts:requirePrivilegedAccessfrom../middleware/privileged-gate.js(mirroringcustom-tools.routes.ts:7).if (!requirePrivilegedAccess(req, reply, { feature: "Extension install/update/delete" })) return;as the first statement of POST, PATCH, and DELETE (mirroringcustom-tools.routes.ts:31/45/59). The POST handler gains areplyparam so the gate can send its 403.ID_PATTERNguard so an unprivileged caller fails closed and can't probe which extension IDs exist.For the primary single-operator deployment (loopback or basic-auth-satisfied,
MARINARA_REQUIRE_ADMIN_SECRET_ON_LOOPBACKunset) the gate returnstrueand there is no observable change.Not a regression: byte-identical on
main; long-standing parity gap with the custom-tools route.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
pnpm checkpasses locally (type-checks the addedreplyparam and the gate call signatures against the existing, already-testedrequirePrivilegedAccess). The change is a mechanical mirror of the custom-tools route — no behavior is added beyond invoking the shared gate.Still to verify manually against the deploy:
GET /api/extensionsstill returns the list (the client loader is unbroken — primary negative control).ADMIN_SECRETset andMARINARA_REQUIRE_ADMIN_SECRET_ON_LOOPBACK=true(or from a non-loopback IP without theX-Admin-Secretheader),POST/PATCH/DELETE /api/extensionsnow return 403, exactly as the custom-tools route already does.Docs and release impact
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.