mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
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#8010
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/7934
Author: @Gunterlie
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/21/2026
Merged by: @Gunterlie
Base:
staging← Head:chore/access-policy-7911📝 Commits (2)
754903drefactor(server): extract access decision into pure access-policy module (#7911)2503c47refactor(server): memoize access policy per request, extend regression (#7911)📊 Changes
5 files changed (+403 additions, -105 deletions)
View changed files
➕
packages/server/src/middleware/access-policy.ts(+156 -0)📝
packages/server/src/middleware/basic-auth.ts(+10 -25)📝
packages/server/src/middleware/ip-allowlist.ts(+87 -68)📝
packages/server/src/middleware/privileged-gate.ts(+4 -12)➕
scripts/regressions/access-policy.regression.ts(+146 -0)📄 Description
Linked issue
Part of #7911 (parent #7909). Prep slice; the owner-facing status lands in a follow-up PR.
Why this change
#7911 wants the owner to see, in Settings, who can reach their Marinara and why. Today the answer is spread across
basic-auth.ts,ip-allowlist.tsandprivileged-gate.ts, each with its own copy of the loopback / forwarded / allowlist / Docker / Tailscale logic. A status screen built on top of that would be a fourth copy that can drift from what the hooks actually enforce — exactly the kind of drift behind GHSA-25hr. This PR puts the decision in one pure function that the hooks call, so the status screen can later report the same answer the server enforces.No access decision changes. An adversarial review compared old vs new for every hook and case (plain / forwarded / relayed-Host loopback, own hostname,
:authority, LAN with and without opt-in, allowlist set/unset/unparseable, Tailscale, Docker gateway with and without forwarding headers andREQUIRE_AUTH_FOR_DOCKER_PROXY, basic auth on/off, runtime-config hot reload) and found no case that became more permissive.What changed
packages/server/src/middleware/access-policy.ts:evaluateAccessPolicy(facts)— pure, plain data in and out (local,forwardedLoopback,trustedPeer,trustedInterface,allowlisted,ipAllowed,authRequired,lockedDown,basicAuthConfigured,adminSecretConfigured,reason).ip-allowlist.ts:getAccessPolicy(request)gathers the facts and memoizes them per request (WeakMap), so hooks that ask several times pay once;getRequestAccessadds the existing once-per-process bypass warnings.ipAllowlistHook,isTrustedInterfaceRequest,isForwardedLoopbackRequestuse it.basic-auth.ts,privileged-gate.ts: callgetRequestAccessinstead of their own copies.scripts/regressions/access-policy.regression.tspinning the decision for loopback variants, own hostname, LAN, allowlist, Tailscale, remote opt-in, and Docker gateway cases.Known difference: the Tailscale/Docker bypass warnings (still once per process) can now be logged on the first non-loopback request through any hook rather than only at the trusted-interface check. Trigger conditions are unchanged.
Validation
pnpm check(full) passes locally.Regressions passing locally: access-policy, loopback-proxy-auth-security, docker-gateway-auth-security, docker-proxy-auth, basic-auth-throttle-security, request-host-security, multiplayer-control-security, android-local-auth.
Local CodeRabbit: 2 trivial findings (stale doc comment, eager per-request facts), both fixed.
pnpm checkpasses locallyContainer (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.mdManual verification notes
X-Forwarded-Forstill requires auth.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)UI evidence (if applicable)
Server-only; no UI change.
Summary by CodeRabbit
Bug Fixes
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.