mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7268] [MERGED] fix: stop client extensions that flood the sandbox with heartbeats #7656
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#7656
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/7268
Author: @SpicyMarinara
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/extension-sandbox-security-followup📝 Commits (2)
269c897fix: count heartbeat floods toward the extension sandbox message limit7b57838Merge origin/staging into fix/extension-sandbox-security-followup📊 Changes
3 files changed (+55 additions, -25 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
packages/server/src/routes/personal-extensions.routes.ts(+7 -1)📝
scripts/regressions/extension-security.regression.ts(+47 -24)📄 Description
Linked issue
Refs #7260
Follow-up to #7262, found during a security review of the client extension sandbox after that PR landed.
Why this change
self.postMessage({ type: "heartbeat" }).What changed
packages/server/src/routes/personal-extensions.routes.ts(sandbox bootstrap): the worker bootstrap sends one heartbeat a second. Heartbeats up to that rate, counted since the worker started plus a margin of 10, are still free. Any heartbeat beyond that counts toward the existing message limit, so a flood is stopped like any other:stopped: true, its controls are removed, and the user gets Restart. A backlog after a pause stays within the rate and is not counted.scripts/regressions/extension-security.regression.ts: the #7260 sandbox harness can now start a fresh sandbox. A new case checks that 300 heartbeats arriving at once after a 300 s pause do not stop the worker, and that a flood is stopped with the message-limit notice. The flood check fails on currentstaging. A version that counts every heartbeat fails the backlog check.CHANGELOG.md: user-facing entry.Reviewed and left unchanged (security lens on #7262):
document.hiddenor the iframe clock. It runs only in the worker, which has no document, and its CSS cannot change page visibility. In Chromium, WebKit and Firefox, a hung worker in the hidden (display: none) sandbox iframe on a visible page is still stopped after about 5 s.stopped: truefor a different extension. The host matches the message source to that extension's iframe, requires originnulland checks the content hash. An extension can stop only itself this way, and it could already do that by hanging.sandbox.html, which returns 404 unless the extension is enabled, approved for its current hash, allowed by policy and requested with that hash. A changed hash clears the stopped state, and only the approved new version starts.blob:null/…, created from the sandbox's opaque origin. It is not same-origin with the app andconnect-src 'none'applies. The browser releases it when the iframe is removed. Every stop, hash change, Restart and unmount removes the iframe.worker.terminate(), and browsers drop the stopped worker's queued messages; one stop notice reaches the host in all three engines. The host removes the iframe, its contributions and its dispatcher.Validation
pnpm checkpasses locallyCONTRIBUTING.mdAgent-run checks (not a substitute for the boxes above):
pnpm checkpassed.extension-security.regression.tspassed. It fails onstagingwithout the route change ("A heartbeat flood must count toward the sandbox message limit").e2e/personal-extension-restart.e2e.tspassed on desktop Chromium.sandboxDocumentoutput, served with the production CSP, in a hidden sandboxed iframe in Chromium, WebKit and Firefox:confirm()dialog that blocked the page.Manual verification notes
for (let i = 0; i < 4e6; i++) self.postMessage({ type: "heartbeat" })is stopped within about a second, its buttons disappear, Marinara stays responsive and Restart appears.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Only
CHANGELOG.mdchanged.docs/development/personal-extensions.mdalready says the iframe rate-limits messages.UI evidence (if applicable)
No UI changes.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.