[PR #724] [MERGED] Add Docker reverse-proxy auth hardening #4747

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/724
Author: @NeoKazuya
Created: 5/12/2026
Status: ✅ Merged
Merged: 5/12/2026
Merged by: @Romuromylus

Base: main ← Head: fix/docker-proxy-auth-hardening


📝 Commits (2)

  • c1056d9 Add Docker reverse-proxy auth hardening
  • 5c0b01f Merge branch 'main' into fix/docker-proxy-auth-hardening

📊 Changes

7 files changed (+134 additions, -7 deletions)

View changed files

📝 .env.example (+5 -0)
📝 docs/CONFIGURATION.md (+4 -1)
📝 docs/REMOTE_ACCESS.md (+3 -1)
📝 packages/server/src/config/runtime-config.ts (+10 -0)
📝 packages/server/src/middleware/basic-auth.ts (+3 -3)
📝 packages/server/src/middleware/ip-allowlist.ts (+41 -2)
📝 packages/server/test/security-middleware.test.ts (+68 -0)

📄 Description

## Linked issue

Closes #723

Why this change

  • When Marinara is behind a Docker reverse-proxy container, the proxy's Docker bridge IP can trigger the Docker auth bypass before Basic Auth runs.
  • Operators who configure Marinara Basic Auth behind a proxy can end up protecting direct LAN/public traffic but not traffic forwarded by the proxy container.
  • Direct trusted Docker container traffic should keep working without forcing a password prompt.

What changed

  • Added REQUIRE_AUTH_FOR_DOCKER_PROXY for requiring normal auth on proxy-forwarded Docker bridge traffic.
  • Detects common forwarding headers on Docker bridge requests.
  • Preserves existing default behavior unless REQUIRE_AUTH_FOR_DOCKER_PROXY is enabled.
  • Adds warning/docs for Docker reverse-proxy deployments.

Validation

  • 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

  • Node version used for validation: v24.15.0.
  • Focused security middleware test passed: pnpm --filter @marinara-engine/shared build then pnpm --dir packages/server exec tsx --import ./test/setup-env.ts --test test/security-middleware.test.ts (20/20 passing).
  • Full baseline passed: pnpm check.
  • CI-adjacent checks passed: pnpm version:check and pnpm guard:installer-artifacts.
  • Manual Docker bridge auth-boundary check used separate server and client/proxy containers on the same Docker bridge. Default mode returned 200 without auth for forwarded Docker traffic; with REQUIRE_AUTH_FOR_DOCKER_PROXY=true, the same forwarded request returned 401 without auth and 200 with valid Basic Auth.
  • This was a focused Docker bridge auth check, not a full production image build.
  • No UI changes.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

Docs changed in this PR: .env.example, docs/CONFIGURATION.md, and docs/REMOTE_ACCESS.md. README was left unchanged because its current high-level security summary remains accurate.

UI evidence (if applicable)

No UI changes.


🔄 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/724 **Author:** [@NeoKazuya](https://github.com/NeoKazuya) **Created:** 5/12/2026 **Status:** ✅ Merged **Merged:** 5/12/2026 **Merged by:** [@Romuromylus](https://github.com/Romuromylus) **Base:** `main` ← **Head:** `fix/docker-proxy-auth-hardening` --- ### 📝 Commits (2) - [`c1056d9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c1056d9e908654a35b2a9f8302fdd219b689cb4e) Add Docker reverse-proxy auth hardening - [`5c0b01f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5c0b01fa9196b37f9ea4cf363b5c680379b7e131) Merge branch 'main' into fix/docker-proxy-auth-hardening ### 📊 Changes **7 files changed** (+134 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+5 -0) 📝 `docs/CONFIGURATION.md` (+4 -1) 📝 `docs/REMOTE_ACCESS.md` (+3 -1) 📝 `packages/server/src/config/runtime-config.ts` (+10 -0) 📝 `packages/server/src/middleware/basic-auth.ts` (+3 -3) 📝 `packages/server/src/middleware/ip-allowlist.ts` (+41 -2) 📝 `packages/server/test/security-middleware.test.ts` (+68 -0) </details> ### 📄 Description ## Linked issue Closes #723 ## Why this change - When Marinara is behind a Docker reverse-proxy container, the proxy's Docker bridge IP can trigger the Docker auth bypass before Basic Auth runs. - Operators who configure Marinara Basic Auth behind a proxy can end up protecting direct LAN/public traffic but not traffic forwarded by the proxy container. - Direct trusted Docker container traffic should keep working without forcing a password prompt. ## What changed - Added `REQUIRE_AUTH_FOR_DOCKER_PROXY` for requiring normal auth on proxy-forwarded Docker bridge traffic. - Detects common forwarding headers on Docker bridge requests. - Preserves existing default behavior unless `REQUIRE_AUTH_FOR_DOCKER_PROXY` is enabled. - Adds warning/docs for Docker reverse-proxy deployments. ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Node version used for validation: `v24.15.0`. - Focused security middleware test passed: `pnpm --filter @marinara-engine/shared build` then `pnpm --dir packages/server exec tsx --import ./test/setup-env.ts --test test/security-middleware.test.ts` (`20/20` passing). - Full baseline passed: `pnpm check`. - CI-adjacent checks passed: `pnpm version:check` and `pnpm guard:installer-artifacts`. - Manual Docker bridge auth-boundary check used separate server and client/proxy containers on the same Docker bridge. Default mode returned `200` without auth for forwarded Docker traffic; with `REQUIRE_AUTH_FOR_DOCKER_PROXY=true`, the same forwarded request returned `401` without auth and `200` with valid Basic Auth. - This was a focused Docker bridge auth check, not a full production image build. - No UI changes. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) Docs changed in this PR: `.env.example`, `docs/CONFIGURATION.md`, and `docs/REMOTE_ACCESS.md`. README was left unchanged because its current high-level security summary remains accurate. ## UI evidence (if applicable) No UI changes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:10:19 +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#4747
No description provided.