mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #464] [MERGED] feat(security): trust Tailscale and Docker traffic by default (with opt-out) #4630
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#4630
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/464
Author: @LukaTheHero
Created: 5/6/2026
Status: ✅ Merged
Merged: 5/6/2026
Merged by: @LukaTheHero
Base:
main← Head:feat/tailscale-docker-bypass📝 Commits (2)
a17bfeffeat(security): opt-in bypass that trusts Tailscale or Docker traffic24ab338feat(security): default the Tailscale and Docker bypass flags to true📊 Changes
6 files changed (+202 additions, -14 deletions)
View changed files
📝
.env.example(+24 -0)📝
docs/CONFIGURATION.md(+30 -4)📝
docs/REMOTE_ACCESS.md(+39 -5)📝
packages/server/src/config/runtime-config.ts(+38 -0)📝
packages/server/src/middleware/basic-auth.ts(+6 -4)📝
packages/server/src/middleware/ip-allowlist.ts(+65 -1)📄 Description
Summary
BYPASS_AUTH_TAILSCALEandBYPASS_AUTH_DOCKER, treat traffic from100.64.0.0/10(Tailnet CGNAT) and172.16.0.0/12(Docker bridge networks) as trusted — those clients skip both the IP allowlist and Basic Auth, the same way loopback already does.trueso a fresh install with no.envworks over Tailscale or from same-host Docker containers without any setup.BASIC_AUTH_*: bypassed clients skip the prompt, ordinary LAN / public-internet clients still authenticate. The first request that exercises a bypass logs an[auth-bypass]warning so the operator has a paper trail.Why
Two recurring user-friction patterns:
100.64.0.0/10by default doesn't violate the safe-by-default ethos the way trusting192.168.0.0/16would.172.16.0.0/12) are unreachable from outside the host — external traffic NATs through the bridge gateway and arrives with a different source — so a request that actually shows up with a172.x.x.xsource genuinely came from a container on the same host. Trusting that range is also safe by default.What changed
packages/server/src/config/runtime-config.ts— addedisTailscaleBypassEnabled()/isDockerBypassEnabled()getters using!isDisabledFlag(...)so unset / "true" / "yes" / "1" all enable, only "false" / "no" / "0" / "off" disable.packages/server/src/middleware/ip-allowlist.ts— extracted the Tailscale and Docker CIDRs as named constants, addedisTailscaleIp()/isDockerIp()predicates andisTrustedInterfaceIp()(which checks the bypass flag and logs a one-shot[auth-bypass]warning the first time each range is exercised). Wired intoipAllowlistHookafter the loopback short-circuit.packages/server/src/middleware/basic-auth.ts—isBasicAuthSatisfied()andbasicAuthHook()treatisTrustedInterfaceIp(ip)exactly like loopback orIP_ALLOWLISTmatches..env.example— both flags listed with=true, with inline caveats so users see when to disable.docs/REMOTE_ACCESS.md— rewrote the intro / TL;DR / decision table; new "Option 4: Tailscale or Docker bypass (interface-scoped, on by default)" section; updated Option 1's exemption list.docs/CONFIGURATION.md— new "Trusted-interface bypass" subsection under Access Control; updated the "Safe-by-default lockdown" so its exempt-list is accurate.Caveats (documented)
100.64.0.0/10is also used by some carrier-grade-NAT ISPs. If your server's public uplink is itself behind CGNAT, an internet client could appear with a Tailscale-shaped source IP — setBYPASS_AUTH_TAILSCALE=falseor bindHOSTto yourtailscale0IP.172.16.0.0/12also covers some private LAN deployments that aren't Docker. If your non-Docker LAN uses172.16.x.x/172.20.x.x, setBYPASS_AUTH_DOCKER=false.ALLOW_UNAUTHENTICATED_PRIVATE_NETWORK(which trusts the entire RFC 1918 + CGNAT + ULA + link-local set) stays default-off. This PR only narrows the auto-trust to two interfaces where the access path itself is authenticated.Notes
CONTRIBUTING.md, one should be opened describing the user-facing problem (Tailscale users hitting the lockdown page on a fresh install) before this is merged.mainafter #463 (env hot-reload) merged, so the runtime-config and docs edits coexist cleanly.Test plan
.envfile is reachable from a Tailscale device. Server log shows[auth-bypass] BYPASS_AUTH_TAILSCALE=true …once on first request.http://127.0.0.1:7860) on the host still works regardless of these flags' values.BASIC_AUTH_USER/BASIC_AUTH_PASS, refresh from Tailscale → loads with no prompt; refresh from a regular LAN phone → password prompt.BYPASS_AUTH_TAILSCALE=false, restart, refresh from Tailscale → lockdown page (or password prompt if Basic Auth is configured).IP_ALLOWLIST=192.168.1.0/24(LAN only, NOT including Tailscale), keep defaults, hit from Tailscale → loads; hit from a non-allowlisted, non-Tailscale device → 403.[auth-bypass]warning fires only once per range per process, not on every subsequent request.curl http://<host-bridge-ip>:7860/api/healthfrom a sidecar container → 200, server logs[auth-bypass] BYPASS_AUTH_DOCKER=true …once.Summary by CodeRabbit
New Features
Documentation
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.