mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2884] [Issue]: Privileged gate blocks all non-loopback IPs, breaking Professor Mari on remote/LAN clients #1467
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#1467
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?
Originally created by @Exzyle-lab on GitHub (Jun 27, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2884
Originally assigned to: @SpicyMarinara on GitHub.
Professor Mari workspace endpoints (/professor-mari/workspace/skills, /professor-mari/workspace/status, /professor-mari/workspace/prompt) are inaccessible from any non-loopback IP — including LAN clients and Tailscale. The privileged gate auto-passes 127.0.0.1/::1 but forces all other IPs through an ADMIN_SECRET check. When ADMIN_SECRET is not configured, the gate returns 403 with the message "ADMIN_SECRET is required for privileged APIs." The client-side error formatter misparses this as a missing generation parameter, producing the confusing user-facing message: "The model says the the parameter is required."
Steps to Reproduce
Run Marinara Engine on a desktop machine
Configure IP_ALLOWLIST in .env to allow a remote device's IP (or disable the allowlist)
Connect from a second device on LAN or via Tailscale
Frontend loads normally — settings sync, chat history is visible
Professor Mari displays three errors:
"Professor Mari skills are unavailable" (on page load)
"Professor Mari workspace status is unavailable" (on tapping the first error)
"Professor Mari could not answer right now" (on sending a message)
All three display: "The model says the the parameter is required. Go to Chat Settings > Advanced Parameters and turn on Send for the."
Expected Behavior
Remote clients that pass the IP allowlist and basic auth should have access to Professor Mari workspace endpoints. The privileged gate should respect the existing trusted-interface infrastructure (isTrustedInterfaceRequest in ip-allowlist.ts) rather than requiring a separate ADMIN_SECRET for non-loopback IPs.
Root Cause
packages/server/src/middleware/privileged-gate.ts, requirePrivilegedAccess():
typescript// Line ~36: Only loopback gets auto-pass
if (isLoopbackIp(request.ip)) return true;
// All non-loopback falls through to:
const adminSecret = getAdminSecret();
if (!adminSecret) {
reply.code(403).send({ error: "ADMIN_SECRET is required for privileged APIs" });
return false;
}
isLoopbackIp() only matches 127.0.0.1, ::1, and ::ffff:127.0.0.1. There is no check for isTrustedInterfaceRequest() (which already exists in ip-allowlist.ts and supports Tailscale CGNAT, Docker bridge networks, and configurable trusted private networks).
Secondary Bug: Error message formatting
packages/client/src/lib/generation-parameter-errors.ts, line 60:
javascript/\b([A-Za-z_][A-Za-z0-9_.-]*)\b.{0,40}\bis required/i
This regex captures the first word in any sentence containing "is required." When the privileged gate returns "ADMIN_SECRET is required for privileged APIs", the regex captures "ADMIN_SECRET" — but when the message is wrapped as "the ADMIN_SECRET parameter is required" or similar restatements, it captures the English article "the" instead of the parameter name, producing the double-the output.
Suggested Fix
In privileged-gate.ts, import and use isTrustedInterfaceRequest from ./ip-allowlist.js as an additional auto-pass condition alongside isLoopbackIp:
typescriptimport { isLoopbackIp, isTrustedInterfaceRequest } from "./ip-allowlist.js";
// In requirePrivilegedAccess():
if (isLoopbackIp(request.ip) || isTrustedInterfaceRequest(request)) return true;
This extends the privileged gate to respect the same trusted-interface infrastructure that the IP allowlist already uses, gated behind existing env flags (BYPASS_AUTH_TAILSCALE, TRUSTED_PRIVATE_NETWORKS, etc.).
The regex fix is independent but would improve error messaging for any "is required" error that reaches the formatter.
Environment
Marinara Engine (current build)
Windows 11, Node v24.16.0
Remote access tested via Tailscale (100.x.x.x) and plain LAN — same behavior on both
.env configured with IP_ALLOWLIST, IP_ALLOWLIST_ENABLED=true, ALLOW_UNAUTHENTICATED_PRIVATE_NETWORK=true
@SpicyMarinara commented on GitHub (Jun 27, 2026):
I'll look into it.
@SpicyMarinara commented on GitHub (Jun 27, 2026):
Fixed in the working tree. Professor Mari workspace routes now opt into trusted-network privileged access, so loopback, explicit IP_ALLOWLIST clients, and trusted Tailscale/Docker interfaces can use the workspace endpoints without a separate ADMIN_SECRET. The global privileged gate remains strict by default for high-risk APIs like backups, updates, imports, sidecar actions, haptics, and custom tools. I also guarded the generation-parameter error formatter so ADMIN_SECRET/privileged-auth errors are shown as auth errors instead of being rewritten as missing model parameters.\n\nValidation: pnpm --filter @marinara-engine/server lint; pnpm --filter @marinara-engine/client lint; git diff --check.