[PR #8003] [MERGED] fix(server): tighten Tailscale trust, health details and half-set login (#7914) #8049

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

📋 Pull Request Information

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

Base: staging ← Head: fix/access-hardening-7914


📝 Commits (6)

  • 81f2145 fix(server): harden Tailscale trust, health details and half-set Basic Auth (#7914)
  • cfb516e fix(server): match Tailscale interface per platform and follow the bind address
  • e606f7b fix(server): require Tailscale's IPv6 range on generic VPN interface names
  • d9a6371 fix: type the short health reply and simplify Tailscale docs wording
  • ae3bad4 fix: recognise a protected Marinara in the launcher and pin the Tailscale platform in tests
  • 8f1658f chore: keep .env.example access notes as on staging

📊 Changes

14 files changed (+152 additions, -47 deletions)

View changed files

📝 docs/CONFIGURATION.md (+1 -1)
📝 docs/REMOTE_ACCESS.md (+2 -2)
📝 packages/client/src/App.tsx (+6 -4)
📝 packages/server/src/app.ts (+7 -8)
📝 packages/server/src/config/runtime-config.ts (+1 -1)
📝 packages/server/src/middleware/access-policy.ts (+1 -1)
📝 packages/server/src/middleware/basic-auth.ts (+6 -0)
📝 packages/server/src/middleware/ip-allowlist.ts (+32 -3)
📝 scripts/check-port-available.mjs (+9 -10)
📝 scripts/regressions/access-policy.regression.ts (+33 -5)
📝 scripts/regressions/access-status.regression.ts (+2 -2)
📝 scripts/regressions/docker-proxy-auth.regression.ts (+16 -2)
📝 scripts/regressions/launcher/existing-server.regression.mjs (+14 -1)
📝 scripts/regressions/robustness-runtime-diagnostics.regression.ts (+22 -7)

📄 Description

Part of #7914 (parent #7909).

Why

Secure defaults should not depend on guesses. Three places were looser than they need to be:

  • Automatic Tailscale trust looked only at the address range. That range is also used outside Tailscale, so the check now also requires a real Tailscale interface.
  • /api/health returned version and runtime details to every caller, including ones that are not allowed in.
  • A half-set login (BASIC_AUTH_USER without BASIC_AUTH_PASS, or the reverse) was silently ignored, so you could believe a login was active when it was not.

What changed

  • Tailscale trust: automatic trust needs the local socket address on a Tailscale interface: name starting with tailscale on Linux/Windows; on macOS (utun*) and Android (tun*) the interface must also carry Tailscale's IPv6 range. The access status follows the same rule and the bound address. BYPASS_AUTH_TAILSCALE=true|false works as before. A custom Linux tun name now needs a login or BYPASS_AUTH_TAILSCALE=true (documented).
  • /api/health: callers that are not allowed in get only { "status": "ok" } (still HTTP 200, so uptime monitors keep working). The client's update check and HealthResponse handle the short reply.
  • Launcher: check-port-available.mjs treats that exact short reply as "Marinara already runs (sign-in required)" and exits 2, so a protected install is not reported as "port in use". The script never sends credentials. This contract change was a maintainer decision during the gate review (another body still exits 1).
  • Half-set login: a startup warning names the empty variable; values are never logged.
  • Tests: the Tailscale rule takes the platform as a parameter; fixtures for Linux, macOS and Android, including cases that must stay untrusted. The real /api/health route is tested with MARINARA_ANDROID_SECRET.
  • Docs: REMOTE_ACCESS.md and CONFIGURATION.md updated.

Manual verification

  • Linux with Tailscale: open Marinara from another tailnet device and confirm it still opens without a password.
  • macOS with Tailscale (utun interface): same check.
  • Android/Termux with Tailscale: same check.
  • Windows with Tailscale: same check.
  • From a device that is not allowed in, request /api/health and confirm the reply is only {"status":"ok"}.
  • Set Basic Auth with a LAN HOST, start Marinara, run start.sh again and confirm it says "already running (sign-in required)".
  • Set only BASIC_AUTH_USER and confirm the startup log warns about the missing BASIC_AUTH_PASS.

Review

Opus gate review: ready after fixes; all fixed (launcher contract, platform-testable rule, tun-name docs, Android health test). Local CodeRabbit: 3 runs; findings fixed except one rejected: "do not identify a service by status alone" on check-port-available.mjs — this is the maintainer-chosen contract above.

Local checks: regressions access-, docker-proxy, robustness-runtime, launcher/existing-server, basic-auth, health, and pnpm check pass.

Follow-up

docs-i18n: REMOTE_ACCESS.md and CONFIGURATION.md need the same change in the translated packs; I will open that PR after this one merges.


🔄 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/8003 **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:** `fix/access-hardening-7914` --- ### 📝 Commits (6) - [`81f2145`](https://github.com/Pasta-Devs/Marinara-Engine/commit/81f2145dc602896d2e0639521850502563593912) fix(server): harden Tailscale trust, health details and half-set Basic Auth (#7914) - [`cfb516e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cfb516eb1fa7ac2e6d0918632b3b678c5226353a) fix(server): match Tailscale interface per platform and follow the bind address - [`e606f7b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e606f7b14e558e8215fde6d19f4f56e84b1af97b) fix(server): require Tailscale's IPv6 range on generic VPN interface names - [`d9a6371`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d9a63718b207d9db5ccfa3434c8fe344d12c3237) fix: type the short health reply and simplify Tailscale docs wording - [`ae3bad4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ae3bad4e62bfe856d20932b0f33b6014a0340f4e) fix: recognise a protected Marinara in the launcher and pin the Tailscale platform in tests - [`8f1658f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8f1658f5bdc49bbbf2c31fe48876c3e2a8879465) chore: keep .env.example access notes as on staging ### 📊 Changes **14 files changed** (+152 additions, -47 deletions) <details> <summary>View changed files</summary> 📝 `docs/CONFIGURATION.md` (+1 -1) 📝 `docs/REMOTE_ACCESS.md` (+2 -2) 📝 `packages/client/src/App.tsx` (+6 -4) 📝 `packages/server/src/app.ts` (+7 -8) 📝 `packages/server/src/config/runtime-config.ts` (+1 -1) 📝 `packages/server/src/middleware/access-policy.ts` (+1 -1) 📝 `packages/server/src/middleware/basic-auth.ts` (+6 -0) 📝 `packages/server/src/middleware/ip-allowlist.ts` (+32 -3) 📝 `scripts/check-port-available.mjs` (+9 -10) 📝 `scripts/regressions/access-policy.regression.ts` (+33 -5) 📝 `scripts/regressions/access-status.regression.ts` (+2 -2) 📝 `scripts/regressions/docker-proxy-auth.regression.ts` (+16 -2) 📝 `scripts/regressions/launcher/existing-server.regression.mjs` (+14 -1) 📝 `scripts/regressions/robustness-runtime-diagnostics.regression.ts` (+22 -7) </details> ### 📄 Description Part of #7914 (parent #7909). ## Why Secure defaults should not depend on guesses. Three places were looser than they need to be: - Automatic Tailscale trust looked only at the address range. That range is also used outside Tailscale, so the check now also requires a real Tailscale interface. - `/api/health` returned version and runtime details to every caller, including ones that are not allowed in. - A half-set login (`BASIC_AUTH_USER` without `BASIC_AUTH_PASS`, or the reverse) was silently ignored, so you could believe a login was active when it was not. ## What changed - **Tailscale trust:** automatic trust needs the local socket address on a Tailscale interface: name starting with `tailscale` on Linux/Windows; on macOS (`utun*`) and Android (`tun*`) the interface must also carry Tailscale's IPv6 range. The access status follows the same rule and the bound address. `BYPASS_AUTH_TAILSCALE=true|false` works as before. A custom Linux tun name now needs a login or `BYPASS_AUTH_TAILSCALE=true` (documented). - **`/api/health`:** callers that are not allowed in get only `{ "status": "ok" }` (still HTTP 200, so uptime monitors keep working). The client's update check and `HealthResponse` handle the short reply. - **Launcher:** `check-port-available.mjs` treats that exact short reply as "Marinara already runs (sign-in required)" and exits 2, so a protected install is not reported as "port in use". The script never sends credentials. This contract change was a maintainer decision during the gate review (another body still exits 1). - **Half-set login:** a startup warning names the empty variable; values are never logged. - **Tests:** the Tailscale rule takes the platform as a parameter; fixtures for Linux, macOS and Android, including cases that must stay untrusted. The real `/api/health` route is tested with `MARINARA_ANDROID_SECRET`. - **Docs:** `REMOTE_ACCESS.md` and `CONFIGURATION.md` updated. ## Manual verification - [ ] Linux with Tailscale: open Marinara from another tailnet device and confirm it still opens without a password. - [ ] macOS with Tailscale (utun interface): same check. - [ ] Android/Termux with Tailscale: same check. - [ ] Windows with Tailscale: same check. - [ ] From a device that is not allowed in, request `/api/health` and confirm the reply is only `{"status":"ok"}`. - [ ] Set Basic Auth with a LAN `HOST`, start Marinara, run `start.sh` again and confirm it says "already running (sign-in required)". - [ ] Set only `BASIC_AUTH_USER` and confirm the startup log warns about the missing `BASIC_AUTH_PASS`. ## Review Opus gate review: ready after fixes; all fixed (launcher contract, platform-testable rule, tun-name docs, Android health test). Local CodeRabbit: 3 runs; findings fixed except one rejected: "do not identify a service by status alone" on `check-port-available.mjs` — this is the maintainer-chosen contract above. Local checks: regressions `access-`, `docker-proxy`, `robustness-runtime`, `launcher/existing-server`, `basic-auth`, `health`, and `pnpm check` pass. ## Follow-up docs-i18n: `REMOTE_ACCESS.md` and `CONFIGURATION.md` need the same change in the translated packs; I will open that PR after this one merges. --- <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:58 +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#8049
No description provided.