[PR #8093] [MERGED] fix(#7912): remote-login friction-walk fixes (code side) #8096

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

📋 Pull Request Information

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

Base: feat/7912-remote-login ← Head: fix/7912-friction


📝 Commits (7)

  • 891db46 fix(docker): ship reset-login in the image, drop the Docker bypass nudge (#7912)
  • bfd7241 fix(server): let signed-in browsers manage the login; readable setup code (#7912)
  • f877f28 fix(client): Settings login for signed-in devices, sign out here, stacked banners (#7912)
  • dda9625 fix(server): print a new setup code when saving the Settings login fails (#7912)
  • 526ee25 fix(server): hide the setup code only for a trusted proxy; label direct LAN visitors (#7912)
  • 1ebf172 fix(client): show app banners below the top bar so they leave the composer free (#7912)
  • 6ae4098 fix(client): stack top toasts below the app banner (#7912)

📊 Changes

22 files changed (+858 additions, -262 deletions)

View changed files

📝 Dockerfile (+2 -0)
📝 packages/client/src/App.tsx (+15 -2)
📝 packages/client/src/components/diagnostics/use-access-warning-banner.tsx (+4 -2)
📝 packages/client/src/components/diagnostics/use-refused-device-banners.tsx (+2 -2)
📝 packages/client/src/components/layout/AppBannerHost.tsx (+5 -5)
📝 packages/client/src/components/panels/settings/AccessStatusSettings.tsx (+34 -12)
📝 packages/client/src/components/panels/settings/RemoteLoginSettings.tsx (+156 -31)
📝 packages/client/src/components/ui/AppBanner.tsx (+36 -6)
📝 packages/client/src/hooks/use-remote-login.ts (+27 -3)
📝 packages/client/src/lib/api-client.ts (+2 -1)
📝 packages/client/src/localization/locales/en.json (+20 -3)
📝 packages/server/src/config/login-credential.ts (+50 -14)
📝 packages/server/src/middleware/basic-auth.ts (+234 -129)
📝 packages/server/src/middleware/ip-allowlist.ts (+4 -3)
📝 packages/server/src/middleware/privileged-gate.ts (+12 -1)
📝 packages/server/src/middleware/rate-limit.ts (+4 -2)
📝 packages/server/src/routes/access-status.routes.ts (+82 -28)
📝 scripts/regressions/access-status.regression.ts (+8 -0)
📝 scripts/regressions/lockdown-setup-security.regression.ts (+28 -6)
📝 scripts/regressions/loopback-proxy-auth-security.regression.ts (+3 -0)

...and 2 more files

📄 Description

Why

The #7912 friction walk found that the remote-login flow breaks for the most common self-hosted setup: Docker. The browser on the Docker host arrives from the Docker gateway, so it is not "this computer". It could not set, change or remove the login, could not manage devices and did not see the owner banners without ADMIN_SECRET. The walk also found copy, layout and recovery gaps (setup code hard to find and type, lockdown page written for native installs, pnpm reset-login missing from the image, banners covering the top bar).

This PR fixes the code side. Docs are fixed in a separate PR by another agent.

What changed

  • A signed-in browser session (cookie, not a bare Basic header) can manage the login and devices: status, refusals, list/sign out sessions, add a device. Changing or removing the login needs the current password in the same request. Never granted by the Docker gateway address. This computer and ADMIN_SECRET work as before.
  • With no login, Settings → Advanced → Access on a refused device takes the one-time setup code (same single-use, constant-time, setup-bucket rules as the lockdown form). New GET /api/access/setup-code tells the client whether a code is waiting. This removes the "Only this computer or a signed-in device can add a device" dead end.
  • Setup code: XXXX-XXXX-XXXX-XXXX from an unambiguous alphabet (~79 bits), case-, space- and dash-tolerant, on its own log line and repeated in the refusal warning while no login exists. None when TRUSTED_AUTH_PROXY trusts a proxy (only entries the policy accepts count; a list of typos or public ranges still prints a code), where the "no login yet" banners stay hidden too.
  • Lockdown page with MARINARA_DOCKER: docker logs <container> 2>&1 | grep "setup code" hint, Option 2 via /app/data/.env or compose environment, no gateway address as "your address", no "loopback". Full-height background, wrapping code blocks, no extra footer padding. The setup form keeps the username after a wrong code.
  • /login: "Forgot the password?" hint (native, Docker or .env variant), expired pairing codes get their own message under the field with focus on it, lockouts say "Try again in N minutes". 429 bodies carry retryAfter.
  • pnpm reset-login ships in the Docker image and honours DATA_DIR (docker exec <container> pnpm reset-login). The Docker log line no longer suggests BYPASS_AUTH_DOCKER.
  • Client: "Set it below" focuses the login form; "Login set" toast after the first setup; device list shows sign-in method and first-seen date (no IP); the current device can sign out (POST /logout); banner grammar fixed.
  • Banners: a card just below the top bar that leaves the top bar's buttons and the chat composer free, with a "+N more" count when several wait. Shown to local visitors and signed-in sessions.
  • "One Sign out click removed two sessions": cause found. On a fast server the list refetch finishes between the two clicks of a double click, rows shift, and the second click hits the next row. The click handler now ignores detail > 1.
  • If saving the login fails after the setup code was used, the server prints a new code (CodeRabbit finding).
  • Settings no longer labels a direct LAN visitor "Through a proxy or tunnel": a relayed Host means a proxy only behind a loopback peer; elsewhere only forwarding headers count. Security checks are unchanged.

Base: feat/7912-remote-login. Part of #7912.

Checks

  • Regressions (scripts/regressions/): remote-login, lockdown-setup-security, access-status, access-policy, basic-auth-throttle-security, loopback-proxy-auth-security, route-rate-limits — all pass. Form posts send Origin and Sec-Fetch-Site.
  • pnpm localization:check and pnpm check pass.

Manual verification

  • Manually verify in Docker: the host browser sets the first login in Settings with the setup code.
  • Manually verify in Docker: the signed-in host browser changes the password (current password needed), removes the login, adds a device and signs devices out.
  • Manually verify docker exec <container> pnpm reset-login removes the app login.
  • Manually verify the lockdown page in Docker at 390 px and 1440 px.
  • Manually verify banners do not cover the top bar, the Settings/More buttons or the chat composer at 390 px.
  • Manually verify a fast double click on Sign out ends only one session.

🔄 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/8093 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `feat/7912-remote-login` ← **Head:** `fix/7912-friction` --- ### 📝 Commits (7) - [`891db46`](https://github.com/Pasta-Devs/Marinara-Engine/commit/891db4625914a0acc88b2ac172eacb5e9927bcb4) fix(docker): ship reset-login in the image, drop the Docker bypass nudge (#7912) - [`bfd7241`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bfd724162463c194f5fde9b7ea8e835fb2b9992d) fix(server): let signed-in browsers manage the login; readable setup code (#7912) - [`f877f28`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f877f28f7139ca8a3b51eebecdc27b060f98afe5) fix(client): Settings login for signed-in devices, sign out here, stacked banners (#7912) - [`dda9625`](https://github.com/Pasta-Devs/Marinara-Engine/commit/dda9625ee2052bff5e90b808953ef6e912fccf37) fix(server): print a new setup code when saving the Settings login fails (#7912) - [`526ee25`](https://github.com/Pasta-Devs/Marinara-Engine/commit/526ee2555729417756f0fdaa2418058ee64c0a74) fix(server): hide the setup code only for a trusted proxy; label direct LAN visitors (#7912) - [`1ebf172`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1ebf172d803ba227f23537865d74742e1191b1c7) fix(client): show app banners below the top bar so they leave the composer free (#7912) - [`6ae4098`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6ae409865c186865c2366dbc352110dd9520d470) fix(client): stack top toasts below the app banner (#7912) ### 📊 Changes **22 files changed** (+858 additions, -262 deletions) <details> <summary>View changed files</summary> 📝 `Dockerfile` (+2 -0) 📝 `packages/client/src/App.tsx` (+15 -2) 📝 `packages/client/src/components/diagnostics/use-access-warning-banner.tsx` (+4 -2) 📝 `packages/client/src/components/diagnostics/use-refused-device-banners.tsx` (+2 -2) 📝 `packages/client/src/components/layout/AppBannerHost.tsx` (+5 -5) 📝 `packages/client/src/components/panels/settings/AccessStatusSettings.tsx` (+34 -12) 📝 `packages/client/src/components/panels/settings/RemoteLoginSettings.tsx` (+156 -31) 📝 `packages/client/src/components/ui/AppBanner.tsx` (+36 -6) 📝 `packages/client/src/hooks/use-remote-login.ts` (+27 -3) 📝 `packages/client/src/lib/api-client.ts` (+2 -1) 📝 `packages/client/src/localization/locales/en.json` (+20 -3) 📝 `packages/server/src/config/login-credential.ts` (+50 -14) 📝 `packages/server/src/middleware/basic-auth.ts` (+234 -129) 📝 `packages/server/src/middleware/ip-allowlist.ts` (+4 -3) 📝 `packages/server/src/middleware/privileged-gate.ts` (+12 -1) 📝 `packages/server/src/middleware/rate-limit.ts` (+4 -2) 📝 `packages/server/src/routes/access-status.routes.ts` (+82 -28) 📝 `scripts/regressions/access-status.regression.ts` (+8 -0) 📝 `scripts/regressions/lockdown-setup-security.regression.ts` (+28 -6) 📝 `scripts/regressions/loopback-proxy-auth-security.regression.ts` (+3 -0) _...and 2 more files_ </details> ### 📄 Description ## Why The #7912 friction walk found that the remote-login flow breaks for the most common self-hosted setup: Docker. The browser on the Docker host arrives from the Docker gateway, so it is not "this computer". It could not set, change or remove the login, could not manage devices and did not see the owner banners without `ADMIN_SECRET`. The walk also found copy, layout and recovery gaps (setup code hard to find and type, lockdown page written for native installs, `pnpm reset-login` missing from the image, banners covering the top bar). This PR fixes the code side. Docs are fixed in a separate PR by another agent. ## What changed - A signed-in browser session (cookie, not a bare Basic header) can manage the login and devices: status, refusals, list/sign out sessions, add a device. Changing or removing the login needs the current password in the same request. Never granted by the Docker gateway address. This computer and `ADMIN_SECRET` work as before. - With no login, Settings → Advanced → Access on a refused device takes the one-time setup code (same single-use, constant-time, setup-bucket rules as the lockdown form). New `GET /api/access/setup-code` tells the client whether a code is waiting. This removes the "Only this computer or a signed-in device can add a device" dead end. - Setup code: `XXXX-XXXX-XXXX-XXXX` from an unambiguous alphabet (~79 bits), case-, space- and dash-tolerant, on its own log line and repeated in the refusal warning while no login exists. None when `TRUSTED_AUTH_PROXY` trusts a proxy (only entries the policy accepts count; a list of typos or public ranges still prints a code), where the "no login yet" banners stay hidden too. - Lockdown page with `MARINARA_DOCKER`: `docker logs <container> 2>&1 | grep "setup code"` hint, Option 2 via `/app/data/.env` or compose `environment`, no gateway address as "your address", no "loopback". Full-height background, wrapping code blocks, no extra footer padding. The setup form keeps the username after a wrong code. - `/login`: "Forgot the password?" hint (native, Docker or `.env` variant), expired pairing codes get their own message under the field with focus on it, lockouts say "Try again in N minutes". 429 bodies carry `retryAfter`. - `pnpm reset-login` ships in the Docker image and honours `DATA_DIR` (`docker exec <container> pnpm reset-login`). The Docker log line no longer suggests `BYPASS_AUTH_DOCKER`. - Client: "Set it below" focuses the login form; "Login set" toast after the first setup; device list shows sign-in method and first-seen date (no IP); the current device can sign out (`POST /logout`); banner grammar fixed. - Banners: a card just below the top bar that leaves the top bar's buttons and the chat composer free, with a "+N more" count when several wait. Shown to local visitors and signed-in sessions. - "One Sign out click removed two sessions": cause found. On a fast server the list refetch finishes between the two clicks of a double click, rows shift, and the second click hits the next row. The click handler now ignores `detail > 1`. - If saving the login fails after the setup code was used, the server prints a new code (CodeRabbit finding). - Settings no longer labels a direct LAN visitor "Through a proxy or tunnel": a relayed Host means a proxy only behind a loopback peer; elsewhere only forwarding headers count. Security checks are unchanged. Base: `feat/7912-remote-login`. Part of #7912. ## Checks - Regressions (`scripts/regressions/`): remote-login, lockdown-setup-security, access-status, access-policy, basic-auth-throttle-security, loopback-proxy-auth-security, route-rate-limits — all pass. Form posts send `Origin` and `Sec-Fetch-Site`. - `pnpm localization:check` and `pnpm check` pass. ## Manual verification - [ ] Manually verify in Docker: the host browser sets the first login in Settings with the setup code. - [ ] Manually verify in Docker: the signed-in host browser changes the password (current password needed), removes the login, adds a device and signs devices out. - [ ] Manually verify `docker exec <container> pnpm reset-login` removes the app login. - [ ] Manually verify the lockdown page in Docker at 390 px and 1440 px. - [ ] Manually verify banners do not cover the top bar, the Settings/More buttons or the chat composer at 390 px. - [ ] Manually verify a fast double click on Sign out ends only one session. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:10:20 +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#8096
No description provided.