mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #8773] [MERGED] fix(extensions): keep the sandbox document opaque-origin everywhere #8797
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#8797
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/8773
Author: @SpicyMarinara
Created: 11/3/2026
Status: ✅ Merged
Merged: 11/3/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/hardening-extension-sandbox-page📝 Commits (1)
7a390b9fix(extensions): keep the sandbox document opaque-origin everywhere📊 Changes
4 files changed (+41 additions, -3 deletions)
View changed files
📝
packages/client/src/lib/slash-commands.ts(+8 -1)📝
packages/server/src/routes/personal-extensions.routes.ts(+2 -1)📝
scripts/regressions/extension-dice-formats.regression.ts(+13 -1)📝
scripts/regressions/extension-security.regression.ts(+18 -0)📄 Description
Linked issue
Closes #8769
Why this change
A sandboxed (not full-page) Browser Extension is approved as the isolated kind: no page, DOM, origin storage or network. Its sandbox document got that isolation only from the client's iframe sandbox attribute. The document's own Content-Security-Policy had no sandbox directive, so opened any other way it ran in Marinara's origin. Separately, plainDiceText claimed to make extension dice text plain, but backslashes do not stop HTML, and the chat renderer decodes entity-encoded tags back into HTML. Extension text in a /roll message could therefore carry markup.
What changed
sandbox allow-scriptsin its Content-Security-Policy, matching the multiplayer guest document. It keeps an opaque origin wherever it loads.<,>and&as the full-width lookalikes < > &, so that text can no longer render as HTML.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Agent-run checks (for reference; each regression was shown to fail without its fix):
node ./scripts/pnpm-runner.mjs build:shared: completed (shared tsc build)node ./scripts/run-regressions.mjs --filter extension-security (baseline, before edits): 1/1 passednode ./scripts/run-regressions.mjs --filter extension-dice-formats (baseline, before edits): 1/1 passedgit stash push -- <2 source files>; run both regressions; git stash pop: both FAILED without the fix (CSP lacks sandbox; containsChatHtml true), both PASSED after restorenode ./scripts/run-regressions.mjs --filter extension-security / extension-dice-formats (with fix): 1/1 passed eachnode ./scripts/run-regressions.mjs --filter for each of: character-identity, conversation-game-slash, convo-video-command, dice-notation (2), extension- (6), op: all passed (15 files total, 0 failed)packages/server: node ../../scripts/pnpm-runner.mjs run lint (tsc -b ../shared && tsc --noEmit && tsc -p regressions character-activity): exit 0packages/client: node ../../scripts/pnpm-runner.mjs run lint (eslint . + tsc client-lanes): exit 0; 0 errors, 12 pre-existing warnings, none in slash-commands.tspackages/client: tsc -b (the type-check step of the client build): exit 0root: tsc --noEmit -p tsconfig.json (check:e2e-types): exit 0prettier --write on the 4 changed files: all unchanged (already formatted)eslint packages/client/src/lib/slash-commands.ts: exit 0Independent adversarial review: approve.
Known limits and risks:
Low. Inside the client's iframe the sandbox flags are unchanged (allow-scripts in both the attribute and the CSP), and Chromium and WebKit confirmed the worker still starts. Firefox was not tested because it would not launch here. Dice text from extensions that used
<,>or&now shows full-width lookalikes instead of the ASCII characters. The regression .ts files are not covered by a repo tsconfig, so they were run with tsx but not type-checked. docs/development/personal-extensions.md still says the iframe provides the opaque origin, which remains true; no doc change was made. Out of scope for this step: the user's relayed request to make showing an outfit to a love interest in Otome Hearth pay +5 affection instead of +20. That package lives in Pasta-Devs/Marinara-Agents, not this Engine worktree, so nothing was changed for it. A read-only lookup on Agents origin/staging found the value asshowHim: 20in packages/otome-forge/src/engine/packages/client/src/features/otome-forge/shared/economy.ts:55. It is granted in .../server/src/services/otome-forge/routes/wardrobe.ts:399, and the route comment at wardrobe.ts:12 also says +20. That change needs its own Agents branch and PR.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.