[GH-ISSUE #3251] docs: docs/EXTENSIONS.md is out of date - install needs admin access, and extension CSS is sanitized #1747

Closed
opened 2026-10-21 05:42:15 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kolacheee on GitHub (Jul 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3251

Originally assigned to: @SpicyMarinara on GitHub.

docs/EXTENSIONS.md has drifted from the shipped app. Found in a full docs-vs-code audit against v2.1.0. Each item below is independently checkable: open the doc at the noted spot and compare against the app or code. These can all land in one PR that refreshes the file.

2 items found.


1. line 5 ("Extensions are imported from Settings -> Extensions...") - and nowhere else in the 261-line doc

(missing)

The doc presents extension import/management as unconditionally available, but installing, updating (including simply toggling enabled/disabled), and deleting extensions are privileged actions: they succeed only from loopback, or remotely only when ADMIN_SECRET is set in the server .env and saved in Settings -> Advanced -> Admin Access. A user reaching Marinara from another device (LAN, Docker host, Tailscale) who follows this doc gets a 403 on every import - and even the IP allowlist and Basic Auth do not unlock it. The doc never mentions loopback, admin access, or ADMIN_SECRET.

Suggested fix: Add a short note near the intro (after line 5): installing, updating/toggling, or removing extensions requires loopback access or ADMIN_SECRET (server .env) pasted into Settings -> Advanced -> Admin Access; otherwise the server returns 403. Cross-link to docs/CONFIGURATION.md § Privileged APIs. (Optional follow-up: CONFIGURATION.md's own "fail closed" bullet list in that section omits extension install/update/delete - and theme writes per #2947 - so consider adding them there too.)


2. line 257 ("CSS is injected as a style block when the extension is enabled.") and the marinara.addStyle row at line 108

(missing)

The doc implies extension CSS is injected verbatim, but every extension CSS path (manifest css/cssPath and marinara.addStyle) runs through the shared sanitizer before injection: all url() references are rewritten to url(about:invalid) unless they are data: URIs with image/font MIME types, @import and @namespace are stripped, @font-face blocks are removed unless every source is a font data: URI (local() sources also disqualify the block), expression()/javascript:/vbscript:/behavior/-moz-binding are removed, and :visited selectors are rewritten to :link. An extension author using an external background image, @import, or a remote web font will see it silently fail, and this - the doc an extension author would consult - never says why.

Suggested fix: Add a sentence under Import Notes (line 257) and mirror it briefly in the addStyle helper row (line 108): extension CSS is sanitized before injection for security - external url(), @import, @namespace, remote/local() web fonts, and script-like constructs are stripped (external URLs become url(about:invalid)); embed images and fonts as data: URIs instead. Optionally note that :visited selectors are rewritten to :link.

Originally created by @kolacheee on GitHub (Jul 5, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3251 Originally assigned to: @SpicyMarinara on GitHub. `docs/EXTENSIONS.md` has drifted from the shipped app. Found in a full docs-vs-code audit against **v2.1.0**. Each item below is independently checkable: open the doc at the noted spot and compare against the app or code. These can all land in one PR that refreshes the file. **2 items found.** --- ### 1. line 5 ("Extensions are imported from **Settings -> Extensions**...") - and nowhere else in the 261-line doc *(missing)* The doc presents extension import/management as unconditionally available, but installing, updating (including simply toggling enabled/disabled), and deleting extensions are privileged actions: they succeed only from loopback, or remotely only when ADMIN_SECRET is set in the server .env and saved in Settings -> Advanced -> Admin Access. A user reaching Marinara from another device (LAN, Docker host, Tailscale) who follows this doc gets a 403 on every import - and even the IP allowlist and Basic Auth do not unlock it. The doc never mentions loopback, admin access, or ADMIN_SECRET. **Suggested fix:** Add a short note near the intro (after line 5): installing, updating/toggling, or removing extensions requires loopback access or ADMIN_SECRET (server .env) pasted into Settings -> Advanced -> Admin Access; otherwise the server returns 403. Cross-link to docs/CONFIGURATION.md § Privileged APIs. (Optional follow-up: CONFIGURATION.md's own "fail closed" bullet list in that section omits extension install/update/delete - and theme writes per #2947 - so consider adding them there too.) --- ### 2. line 257 ("CSS is injected as a style block when the extension is enabled.") and the marinara.addStyle row at line 108 *(missing)* The doc implies extension CSS is injected verbatim, but every extension CSS path (manifest css/cssPath and marinara.addStyle) runs through the shared sanitizer before injection: all url() references are rewritten to url(about:invalid) unless they are data: URIs with image/font MIME types, @import and @namespace are stripped, @font-face blocks are removed unless every source is a font data: URI (local() sources also disqualify the block), expression()/javascript:/vbscript:/behavior/-moz-binding are removed, and :visited selectors are rewritten to :link. An extension author using an external background image, @import, or a remote web font will see it silently fail, and this - the doc an extension author would consult - never says why. **Suggested fix:** Add a sentence under Import Notes (line 257) and mirror it briefly in the addStyle helper row (line 108): extension CSS is sanitized before injection for security - external url(), @import, @namespace, remote/local() web fonts, and script-like constructs are stripped (external URLs become url(about:invalid)); embed images and fonts as data: URIs instead. Optionally note that :visited selectors are rewritten to :link.
bsakaguchi 2026-10-21 05:42:15 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Jul 5, 2026):

Addressed in #3289.

<!-- gh-comment-id:4887421533 --> @SpicyMarinara commented on GitHub (Jul 5, 2026): Addressed in #3289.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1747
No description provided.