mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7816] [MERGED] fix(security): harden auth for local proxies and Docker gateways #7943
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#7943
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/7816
Author: @SpicyMarinara
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/19/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/harden-auth📝 Commits (2)
fe12123fix(security): harden auth for local proxies and Docker gateways35c34dcdocs: clarify Docker allowlist bypass in remote access guide📊 Changes
15 files changed (+582 additions, -57 deletions)
View changed files
📝
.env.example(+14 -1)📝
README.md(+1 -1)📝
docs/CONFIGURATION.md(+3 -2)📝
docs/REMOTE_ACCESS.md(+37 -7)📝
docs/TROUBLESHOOTING.md(+1 -1)📝
docs/installation/containers.md(+3 -1)📝
packages/server/src/config/runtime-config.ts(+12 -0)📝
packages/server/src/middleware/basic-auth.ts(+71 -25)📝
packages/server/src/middleware/csrf-protection.ts(+2 -2)📝
packages/server/src/middleware/ip-allowlist.ts(+53 -7)📝
packages/server/src/middleware/privileged-gate.ts(+16 -4)📝
packages/server/src/routes/generate/prompt-preview.ts(+6 -3)📝
packages/server/src/routes/updates.routes.ts(+3 -3)➕
scripts/regressions/docker-gateway-auth-security.regression.ts(+102 -0)➕
scripts/regressions/loopback-proxy-auth-security.regression.ts(+258 -0)📄 Description
Linked issue
No linked issue. This comes from a pre-release hardening pass of the access-control middleware.
Why this change
Basic Auth,
IP_ALLOWLIST,ADMIN_SECRETand the loopback-only features are meant to cover every device except the computer running Marinara. Two common setups from our docs need extra handling to keep that true:127.0.0.1, so its visitors looked like the local user.REMOTE_ACCESS.mdrecommends this setup for HTTPS.What changed
ip-allowlist.ts,basic-auth.ts,privileged-gate.ts,csrf-protection.ts,updates.routes.ts):Forwarded,X-Forwarded-*,X-Real-IP) plusCF-Connecting-IP,True-Client-IP, Tailscale's identity and Funnel headers, andVia.REQUIRE_AUTH_FOR_LOOPBACK_PROXYsetting (defaulttrue), mirroringREQUIRE_AUTH_FOR_DOCKER_PROXY. Setting it tofalserestores the previous behaviour for proxies that enforce their own login.IP_ALLOWLIST=127.0.0.1.prompt-preview.ts): the internal preview request drops every forwarding header and the browser-origin headers. It stays a local call, and the outer route has already passed auth and CSRF.ip-allowlist.ts):BYPASS_AUTH_DOCKERempty) now applies only while neither Basic Auth norIP_ALLOWLISTis configured. It still stands in for the no-password lockdown, so the default127.0.0.1-bound compose keeps working.BYPASS_AUTH_DOCKER=truekeeps its explicit meaning.[auth-bypass]warning explains when automatic trust is held back.REMOTE_ACCESS.mdhas a new "Reverse proxies and tunnels on the same computer" section, plus notes on Docker and the allowlist.CONFIGURATION.md,TROUBLESHOOTING.md,installation/containers.md,README.mdand.env.example.loopback-proxy-auth-securityanddocker-gateway-auth-security. Both fail on currentstagingand pass with this change, andpnpm regression:securitypicks both up.Behaviour changes operators may notice:
REQUIRE_AUTH_FOR_LOOPBACK_PROXY=falseif the proxy has its own login.IP_ALLOWLISTset, the host browser is refused unless the gateway is listed. Fix: list the gateway, or use Basic Auth.Validation
pnpm checkpasses locallyCONTRIBUTING.mdWhat the agent ran (for the reviewer to confirm, not a substitute for the boxes above):
pnpm checkpassed.pnpm regression:securitypassed: 21/21 in thesecurityfilter, plus runtime-integrity, shell-sandbox, extension-ipc, android-local-auth and docker-proxy-auth.stagingand pass with the fix.buildApp()with Basic Auth,ADMIN_SECRETandTRUSTED_HOSTSset:IP_ALLOWLISTonlyBYPASS_AUTH_DOCKER=trueManual verification notes
http://127.0.0.1:7860on that machine stays passwordless.REQUIRE_AUTH_FOR_LOOPBACK_PROXY=falsein.envrestores access within a few seconds.BASIC_AUTH_USER/BASIC_AUTH_PASSprompts both the host browser and a phone on the LAN, and that the container logs the one-time[auth-bypass]notice.127.0.0.1, no auth) still opens without a password on the host.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Docs touched:
README.md,.env.example,docs/REMOTE_ACCESS.md,docs/CONFIGURATION.md,docs/TROUBLESHOOTING.md,docs/installation/containers.md. Translated packs follow up in #7817. NoCHANGELOG.mdentry.UI evidence (if applicable)
None: no client UI changes. The server-rendered setup page gains a proxy-specific variant.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.