[PR #7952] [MERGED] feat: Marinara notices from a protected GitHub branch (#7923) #8023

Closed
opened 2026-10-24 04:09:43 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7952
Author: @Gunterlie
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/21/2026
Merged by: @Gunterlie

Base: staging ← Head: feat/owner-notices-7923


📝 Commits (7)

  • 81fe369 feat: show maintainer notices to owners from the notices branch (#7923)
  • ce0e309 Merge remote-tracking branch 'origin/staging' into feat/owner-notices-7923
  • 9ea0752 fix(notices): harden notices fetch, range parsing and link check
  • 342228f fix(server): rate-limit the owner notices route
  • 058b195 fix(notices): check hourly and on startup only
  • 7fe563a refactor(notices): call them Marinara notices; explain them and warn before turning them off
  • d46626a fix(notices): show notices to IP_ALLOWLIST peers; document the kept cache

📊 Changes

12 files changed (+428 additions, -2 deletions)

View changed files

📝 .env.example (+11 -0)
📝 CONTRIBUTING.md (+48 -0)
📝 docs/CONFIGURATION.md (+22 -0)
📝 packages/client/src/components/layout/AppBannerHost.tsx (+2 -1)
➕ packages/client/src/components/layout/use-marinara-notice-banners.tsx (+69 -0)
📝 packages/client/src/localization/locales/en.json (+1 -0)
📝 packages/server/src/config/runtime-config.ts (+4 -0)
📝 packages/server/src/middleware/rate-limit.ts (+6 -0)
📝 packages/server/src/routes/index.ts (+2 -0)
➕ packages/server/src/routes/notices.routes.ts (+151 -0)
📝 packages/server/src/routes/updates.routes.ts (+1 -1)
➕ scripts/regressions/marinara-notices.regression.ts (+111 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.

Linked issue

Closes #7923 (parent #7909).

Why this change

Marinara has no way to tell owners of existing installations about something they must act on — a security fix, a manual step for Docker users, a breaking change. The 2.5.0 proxy/tunnel problem showed the gap: launcher installs update themselves, Docker and Android do not, and the update card only appears when the owner clicks "Check for updates". This adds a small, maintainer-edited notices file that every install built from this version on fetches and shows to the owner, with strict rules so the channel is not used for news and owners keep reading it.

What changed

  • Server packages/server/src/routes/notices.routes.ts: fetches notices.json from the notices branch (raw.githubusercontent.com) at start and every hour (10 s timeout), validates it strictly and serves matching notices at GET /api/notices to owners only (local non-proxied, trusted peers, admin secret, or signed-in users); everyone else gets an empty list. A missing file or branch shows nothing and never blocks startup.
  • Validation: JSON array, max 20 entries / 64 KB; each notice needs id, level (warning | critical), versions, title, text, action, expires; length caps; plain text only; link kept only when it starts with https://github.com/Pasta-Devs/. Version ranges reuse compareVersions from updates.routes.ts.
  • Client use-marinara-notice-banners.tsx: feeds the shared AppBannerHost (one banner at a time, most severe wins); asks once when the page loads and then every hour; the route is rate-limited to 10 requests per minute.
  • Opt-out MARINARA_NOTICES_ENABLED=false, with a warning in .env.example and docs/CONFIGURATION.md (new "Marinara notices" section: what they are, how they work, why they are safe); MARINARA_NOTICES_URL for forks.
  • No "Update now" button: the update flow lives inside SettingsPanel.tsx; notices show their action text and a link instead.
  • Docs: CONTRIBUTING.md "Marinara Notices" (format, example, rules against notice fatigue, how to retire or re-show a notice), docs/CONFIGURATION.md, .env.example.
  • Regression scripts/regressions/marinara-notices.regression.ts.

Validation

  • pnpm check and pnpm localization:check pass locally; marinara-notices regression passes.
  • Opus adversarial review: fix-then-ship; fixed — >= 2.5.0 (space after operator) now matches; body read as a stream and stopped at the size cap (content-length checked first), redirect: "error"; links with a user name/password dropped; docs say invalid JSON keeps the last good notices. Owner gate, plain-text rendering, link allowlist bypasses, timers and polling were checked and found correct.
  • Local CodeRabbit: 2 findings, both fixed (client guard for a malformed notices field; size cap while reading).
  • GitHub review round (CodeRabbit 3, Dottore 3): 3 fixed in d46626a87 (allowlisted peers without a password now see notices via trustedPeer; docs describe the kept cache on a failed download); 3 rejected with reasons in the threads (critical dismissal is per session by design; docs-i18n follows after merge; client request only reaches the local server). Route rate-limited (CodeQL).
  • Not changed: the shared compareVersions treats prerelease suffixes (2.5.1-beta) wrongly; this is existing code and releases use plain X.Y.Z.

Before or soon after merge (maintainer): create the notices branch with notices.json = [] and protect it (maintainers only, one approving review, no force push). Until it exists, every install gets a 404 and shows nothing — safe, but the docs describe the protected branch.

Out of scope: the "Update now" button from the issue (the update flow lives inside SettingsPanel.tsx). A [docs-i18n] docs/CONFIGURATION.md follow-up is needed after merge.

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Manually verify that with no notices branch, the app starts normally and shows no banner.
  • Manually verify a test file served via MARINARA_NOTICES_URL shows a warning and a critical notice on the owner's computer, in light and dark theme, at phone and desktop width.
  • Manually verify a remote visitor who is not signed in never sees a notice.
  • Manually verify a dismissed warning stays hidden after reload, and a critical notice comes back in a new session.
  • Manually verify MARINARA_NOTICES_ENABLED=false stops all fetches.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Screenshots at 390 / 768 / 1440 px, light and dark, warning and critical, were taken locally with a test notices file. The CLI cannot attach images.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7952 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `feat/owner-notices-7923` --- ### 📝 Commits (7) - [`81fe369`](https://github.com/Pasta-Devs/Marinara-Engine/commit/81fe36987bb926cb107258c1b2b32706ec61199f) feat: show maintainer notices to owners from the notices branch (#7923) - [`ce0e309`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ce0e309afa7c3dbcfc051b8b587a2a05530a48ec) Merge remote-tracking branch 'origin/staging' into feat/owner-notices-7923 - [`9ea0752`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9ea07521a61703b26e3620858c693f5f0dab156a) fix(notices): harden notices fetch, range parsing and link check - [`342228f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/342228f361dfc680553623638ace831db5152523) fix(server): rate-limit the owner notices route - [`058b195`](https://github.com/Pasta-Devs/Marinara-Engine/commit/058b19560649020d3fc179ba476fa47faa8f3b62) fix(notices): check hourly and on startup only - [`7fe563a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7fe563af763ef910759d03ed0a9f6323fa6f6884) refactor(notices): call them Marinara notices; explain them and warn before turning them off - [`d46626a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d46626a87950526025aab8470b85b72fae0ea0bb) fix(notices): show notices to IP_ALLOWLIST peers; document the kept cache ### 📊 Changes **12 files changed** (+428 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+11 -0) 📝 `CONTRIBUTING.md` (+48 -0) 📝 `docs/CONFIGURATION.md` (+22 -0) 📝 `packages/client/src/components/layout/AppBannerHost.tsx` (+2 -1) ➕ `packages/client/src/components/layout/use-marinara-notice-banners.tsx` (+69 -0) 📝 `packages/client/src/localization/locales/en.json` (+1 -0) 📝 `packages/server/src/config/runtime-config.ts` (+4 -0) 📝 `packages/server/src/middleware/rate-limit.ts` (+6 -0) 📝 `packages/server/src/routes/index.ts` (+2 -0) ➕ `packages/server/src/routes/notices.routes.ts` (+151 -0) 📝 `packages/server/src/routes/updates.routes.ts` (+1 -1) ➕ `scripts/regressions/marinara-notices.regression.ts` (+111 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. ## Linked issue Closes #7923 (parent #7909). ## Why this change Marinara has no way to tell owners of existing installations about something they must act on — a security fix, a manual step for Docker users, a breaking change. The 2.5.0 proxy/tunnel problem showed the gap: launcher installs update themselves, Docker and Android do not, and the update card only appears when the owner clicks "Check for updates". This adds a small, maintainer-edited notices file that every install built from this version on fetches and shows to the owner, with strict rules so the channel is not used for news and owners keep reading it. ## What changed - Server `packages/server/src/routes/notices.routes.ts`: fetches `notices.json` from the `notices` branch (`raw.githubusercontent.com`) at start and every hour (10 s timeout), validates it strictly and serves matching notices at `GET /api/notices` to owners only (local non-proxied, trusted peers, admin secret, or signed-in users); everyone else gets an empty list. A missing file or branch shows nothing and never blocks startup. - Validation: JSON array, max 20 entries / 64 KB; each notice needs `id`, `level` (`warning` | `critical`), `versions`, `title`, `text`, `action`, `expires`; length caps; plain text only; `link` kept only when it starts with `https://github.com/Pasta-Devs/`. Version ranges reuse `compareVersions` from `updates.routes.ts`. - Client `use-marinara-notice-banners.tsx`: feeds the shared `AppBannerHost` (one banner at a time, most severe wins); asks once when the page loads and then every hour; the route is rate-limited to 10 requests per minute. - Opt-out `MARINARA_NOTICES_ENABLED=false`, with a warning in `.env.example` and `docs/CONFIGURATION.md` (new "Marinara notices" section: what they are, how they work, why they are safe); `MARINARA_NOTICES_URL` for forks. - No "Update now" button: the update flow lives inside `SettingsPanel.tsx`; notices show their `action` text and a link instead. - Docs: `CONTRIBUTING.md` "Marinara Notices" (format, example, rules against notice fatigue, how to retire or re-show a notice), `docs/CONFIGURATION.md`, `.env.example`. - Regression `scripts/regressions/marinara-notices.regression.ts`. ## Validation - `pnpm check` and `pnpm localization:check` pass locally; `marinara-notices` regression passes. - Opus adversarial review: fix-then-ship; fixed — `>= 2.5.0` (space after operator) now matches; body read as a stream and stopped at the size cap (`content-length` checked first), `redirect: "error"`; links with a user name/password dropped; docs say invalid JSON keeps the last good notices. Owner gate, plain-text rendering, link allowlist bypasses, timers and polling were checked and found correct. - Local CodeRabbit: 2 findings, both fixed (client guard for a malformed `notices` field; size cap while reading). - GitHub review round (CodeRabbit 3, Dottore 3): 3 fixed in d46626a87 (allowlisted peers without a password now see notices via `trustedPeer`; docs describe the kept cache on a failed download); 3 rejected with reasons in the threads (critical dismissal is per session by design; docs-i18n follows after merge; client request only reaches the local server). Route rate-limited (CodeQL). - Not changed: the shared `compareVersions` treats prerelease suffixes (`2.5.1-beta`) wrongly; this is existing code and releases use plain `X.Y.Z`. **Before or soon after merge (maintainer):** create the `notices` branch with `notices.json` = `[]` and protect it (maintainers only, one approving review, no force push). Until it exists, every install gets a 404 and shows nothing — safe, but the docs describe the protected branch. Out of scope: the "Update now" button from the issue (the update flow lives inside `SettingsPanel.tsx`). A `[docs-i18n] docs/CONFIGURATION.md` follow-up is needed after merge. - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Manually verify that with no `notices` branch, the app starts normally and shows no banner. - Manually verify a test file served via `MARINARA_NOTICES_URL` shows a `warning` and a `critical` notice on the owner's computer, in light and dark theme, at phone and desktop width. - Manually verify a remote visitor who is not signed in never sees a notice. - Manually verify a dismissed `warning` stays hidden after reload, and a `critical` notice comes back in a new session. - Manually verify `MARINARA_NOTICES_ENABLED=false` stops all fetches. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) Screenshots at 390 / 768 / 1440 px, light and dark, warning and critical, were taken locally with a test notices file. The CLI cannot attach images. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:09:43 +07:00
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#8023
No description provided.