mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5882] [MERGED] fix(agents): Beholder corrections 403 for anyone not on loopback #6980
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#6980
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/5882
Author: @GetBeholder
Created: 9/6/2026
Status: ✅ Merged
Merged: 9/6/2026
Merged by: @GetBeholder
Base:
staging← Head:fix/beholder-state-403📝 Commits (3)
e2cbd0dagents: let Beholder corrections work when the browser is not on loopback7dc292fDrive the route in the reachability regression instead of reading its source8d832b7Merge remote-tracking branch 'origin/staging' into fix/beholder-state-403📊 Changes
2 files changed (+199 additions, -3 deletions)
View changed files
📝
packages/server/src/routes/agents.routes.ts(+19 -3)➕
scripts/regressions/beholder-state-reachable.regression.ts(+180 -0)📄 Description
Linked issue
Reported in Discord by a user running behind a reverse proxy:
Their diagnosis was right on every point.
Why this change
PUT /api/agents/beholder-state/:chatIdwas behindrequirePrivilegedAccess, which admits a request only from loopback or with anX-Admin-Secretheader. A browser cannot send that header — the shipped Beholder package contains the string zero times — so behind a reverse proxy, on a LAN, or through a tunnel, every slot correction and the entire "start over" action was impossible, with no setting an operator could change. Following the error's own advice and settingADMIN_SECRETwould not have helped.It failed silently at both ends. The gate does not log, so the server said nothing; and the panel's error toast was invisible until beholder 1.3.9, so the UI said nothing either. That is why it was reported as the whole feature being broken rather than one blocked action — and why "disabling and re-enabling the agent doesn't clear the data" followed, since the tracked state lives in the last successful run and the only route that clears it was the one returning 403.
The gate was the wrong tool here. This route writes one chat's own tracked state — the same class of act as editing a message in that chat — and
chats.routes.tsguards none of its writes this way (zero uses in the entire file). Sitting next to the genuinely administrative routes inagents.routes.ts,import-policyandimport, gave it company it does not keep.What changed
requirePrivilegedAccessfrom that one route, with the reasoning recorded inline so it is not reintroduced by someone tidying up an inconsistency.scripts/regressions/beholder-state-reachable.regression.ts.Unchanged, and what protects the route instead:
app.ts, which every route in the product sits behind;normalizeBeholderState, which refuses a malformed body rather than letting it reach the state the next prompt is built from.import-policyandimportkeep their gate, and the regression asserts that too — the point is that this route was miscategorised, not that the gate is wrong.Verification
Reproduced against a real server, authenticated, from a non-loopback address (
192.168.x.x, which is what a reverse proxy looks like to the server):PUT /api/agents/beholder-state/:chatIdADMIN_SECRET is required for privileged APIsBoth builds were run from the same working tree with the same data and credentials; the only difference was this change, set aside and restored with
git stashto produce the "before" row.The new regression asserts both halves: that
requirePrivilegedAccessstill rejects such a request when called (so nobody concludes the gate was harmless and the change unnecessary), and that this route no longer calls it.docker-proxy-auth.regression.tsstill passes, which is the check that the gate itself is unmodified. Server typecheck clean.Note for reviewers
This removes an authorization check, so it deserves a careful read rather than a rubber stamp. The argument is that the check was never reachable for the feature's actual users, protected nothing an authenticated caller could not already do through
chats.routes.ts, and cost every non-loopback install the ability to correct its own data. If you would rather keep a check here, the consistent version would be{ trustedNetwork: true }plus the client sending credentials — but that still leaves reverse-proxy users out, and the neighbouring GET on the same path has never been guarded at all.🤖 Generated with Claude Code
https://claude.ai/code/session_01992DGH2exasKGaJiqRnteC
Summary by CodeRabbit
Bug Fixes
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.