mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3603] [Issue]: Remote admin folder picker omits the configured admin header #1949
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#1949
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 @Xelvanis on GitHub (Jul 14, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3603
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Remote administrators cannot use Agent Editor's custom-music folder picker even after correctly configuring and saving
ADMIN_SECRET. The picker calls the privileged endpoint with directfetch(), so it omits theX-Admin-Secretheader that Marinara's shared API client normally supplies.This is one confirmed user-facing instance of a wider client architecture problem: the current client contains 52 direct internal
/apifetches across 12 modules despite the documented requirement to useapi.*from@/lib/api-client.Expected behavior
After a remote user saves the matching secret under Settings → Advanced → Admin Access, selecting a custom music folder should send that secret through Marinara's shared API client and open the server-side folder picker.
Actual behavior
AgentEditorcallsPOST /api/game-assets/pick-local-music-folderwith directfetch()and only aContent-Typeheader. The route intentionally callsrequirePrivilegedAccess(...), so a non-loopback request is rejected with HTTP 403 andInvalid or missing X-Admin-Secret headereven though the browser has a valid saved admin secret.The server is failing closed as intended; the client simply does not attach the configured credentials for this call.
Steps to reproduce
ADMIN_SECRET, and open it from a non-loopback browser.POST /api/game-assets/pick-local-music-folderreturns HTTP 403 withInvalid or missing X-Admin-Secret headerinstead of opening the folder picker.Environment
bcd4e836)Logs, screenshots, or video
Relevant client call:
Relevant server response path:
This was confirmed from the request and authorization paths; it has not been manually reproduced against a separate remote device.
Additional context
Focused fix
Route this request through the existing shared client, for example
api.post<{ success: boolean; path: string }>("/game-assets/pick-local-music-folder").apiFetch()already attaches the savedX-Admin-Secret, adds the CSRF header for unsafe methods, disables caching, and normalizes error handling.Related closed issue: #3055 addressed server-side access around local music files. This report is different: the picker is correctly privileged, but its legitimate remote-admin client does not send the configured credential.
Wider direct-fetch inventory
The same audit found 52 direct internal
/apifetches across 12 modules:components/bot-browser/BotBrowserView.tsxcomponents/agents/AgentEditor.tsxcomponents/modals/STBulkImportModal.tsxcomponents/panels/SettingsPanel.tsxhooks/use-scene-analysis.tsApp.tsxcomponents/chat/ChatBranchSelector.tsxcomponents/layout/ChatSidebar.tsxcomponents/ui/GifPicker.tsxhooks/use-knowledge-sources.tslib/tts-service.tsstores/chat.store.tsNot every direct call is necessarily producing a visible bug today, and raw/streaming responses may need
api.raw()rather than the normal JSON helpers. However, all direct internal calls bypass some combination of shared admin headers, CSRF headers,cache: "no-store", fallback-header handling, and normalized errors.The client instructions already say: “Don't use
fetch()directly. Always useapi.*from@/lib/api-client.” The smallest sustainable follow-up is incremental migration usingapi.raw,api.upload, or the normal helpers, followed by an ESLint restriction preventing direct internal/apifetches outsideapi-client.ts.Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Jul 14, 2026):
Claimed by @SpicyMarinara. I’m routing the Agent Editor folder-picker request through the shared authenticated API client so remote admin and CSRF headers are attached, with a focused regression guard against direct fetch for this privileged endpoint.
@SpicyMarinara commented on GitHub (Jul 14, 2026):
Fixed in #3605 and merged to
stagingasacc3d3b22. The privileged Agent Editor folder picker now uses the shared API client, attaching the configured remote-admin and CSRF headers. Focused regression coverage, full checks, UI smoke, container build, and CodeRabbit review passed.