[Security] Fail closed before exposing privileged frontend APIs#246
Open
fettpl wants to merge 5 commits into
Open
[Security] Fail closed before exposing privileged frontend APIs#246fettpl wants to merge 5 commits into
fettpl wants to merge 5 commits into
Conversation
fettpl
force-pushed
the
p1/issue-221-frontend-auth
branch
from
July 17, 2026 22:59
b2f1116 to
64383a1
Compare
Author
|
@0xSero This ready/non-draft fork PR now points to independently reviewed exact head bf577aa. Its 25-test access-control suite, full repository check, intact pre-push quality/build hook, production desktop package, strict installed signature, and isolated live desktop-health validation passed. Current-head workflows are waiting at GitHub’s fork approval gate: CI run 29732075157 and Security run 29732075003. Please approve these runs when convenient. |
fettpl
marked this pull request as ready for review
July 18, 2026 04:59
fettpl
force-pushed
the
p1/issue-221-frontend-auth
branch
from
July 20, 2026 09:36
9b854b5 to
bf577aa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fails closed before a production web deployment can expose Local Studio's privileged terminal, filesystem, connector, browser, and coding-agent surfaces. Production now requires an operator token or an explicit unauthenticated acknowledgement, while desktop bypass is tied to explicit desktop identity and loopback binding.
Closes #221
Dependency
Depends on #244, whose release-gating repair keeps the current repository quality gate green. The access-control implementation is independently reviewable on top of that prerequisite.
Root cause and threat model
Frontend access is equivalent to shell and filesystem access as the Local Studio host user. The previous production posture admitted requests when no frontend token was configured, and
LOCAL_STUDIO_DATA_DIRincorrectly acted as a desktop identity signal. Query-token exchange also placed the shared secret in URLs, where browser history, reverse proxies, access logs, and telemetry could retain it.Token-gating only browser navigation was insufficient because the standalone agent runtime calls selected frontend routes and both processes can spawn descendants. Operator and callback credentials therefore also had to be contained across the runtime proxy, MCP processes, terminal commands, Git commands, logs, errors, and child environments.
Solution design
LOCAL_STUDIO_FRONTEND_TOKENor explicitLOCAL_STUDIO_FRONTEND_ALLOW_UNAUTHENTICATED=truein production web mode.LOCAL_STUDIO_DESKTOP=1with an explicit loopbackHOSTNAME;LOCAL_STUDIO_DATA_DIRhas no authorization effect.api_keyon/api/proxy/**where the proxy consumes it, removes it from the forwarded URL, and converts it to the controller authorization header.Acceptance criteria
api_keyquery compatibility is limited to the proxy boundary and is consumed before forwarding or logging.Validation
bf577aa9a55f3ff42464f91a99d76c173fdd70a5.npm --prefix frontend run test:access-control: 25 tests, 0 failures.npm --prefix frontend run check:quality: passed, including the access-control suite and production build.npm run check: passed, including contracts, structure, frontend, and controller gates.npm --prefix services/agent-runtime run build: passed.npm --prefix frontend run desktop:dist: passed./Applications/Local Studio.appreinstall: strict deep code-signature verification passed and bundle ID isorg.local.studio.desktop.GET /api/desktop-healthreturned HTTP 200 with{"ok":true}.Current
maindoes not definenpm run test:integrationor a genericnpm --prefix frontend run testscript, so those unavailable commands are not represented as passing.UI changes
Adds an access form composed from existing UI-kit primitives. No new design-system primitive is introduced.
Risks and rollout
frontend/.env.localremains operator-managed.mainif GitHub does not remove the stacked prerequisite automatically.