[Security] Reject cross-site and DNS-rebound requests to any keyless controller#242
Open
fettpl wants to merge 5 commits into
Open
[Security] Reject cross-site and DNS-rebound requests to any keyless controller#242fettpl wants to merge 5 commits into
fettpl wants to merge 5 commits into
Conversation
fettpl
force-pushed
the
p1/issue-222-controller-csrf
branch
from
July 17, 2026 19:55
61086a4 to
a4f0520
Compare
Author
|
@0xSero PR #242 is refreshed through the reviewed PR #244 dependency onto current An independent P0/P1 review found no blockers. The 13-case security boundary suite, strict test typecheck, full repository gate, normal pre-push quality/build hook, and canonical desktop acceptance all passed. GitHub reports the PR mergeable, ready, and blocked only by review/workflow approval. The exact-head workflows are |
fettpl
force-pushed
the
p1/issue-222-controller-csrf
branch
from
July 18, 2026 11:03
a4f0520 to
cca1a89
Compare
fettpl
marked this pull request as ready for review
July 18, 2026 11:06
fettpl
force-pushed
the
p1/issue-222-controller-csrf
branch
from
July 20, 2026 09:15
5c38056 to
fa8f537
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
Adds an explicit request-authority and browser-origin boundary to every controller posture without an API key. Hostile cross-site requests and DNS-rebound authorities are rejected before CORS, controller logging, observability, rate limiting, authentication, or route execution.
Closes #222
Dependency
This branch retains the two reviewed PR #244 prerequisite commits (
ee9c5945and3d0270ff). The #244 package delta remains exactly the removal of the redundant directplaywrightdeclaration fromfrontend/package.jsonand its root lockfile entry;@playwright/testcontinues to provide the transitive runtime.Root cause
Without
LOCAL_STUDIO_API_KEY, protected routes admitted every request. CORS controlled browser response visibility but did not prevent request execution, and the controller did not validate the requestHostauthority against the configured bind topology.Solution design
LOCAL_STUDIO_ALLOWED_HOSTSconfiguration containing exact hostname or IP authorities.localhost,127.0.0.1,::1, andhost.docker.internal.0.0.0.0or::bind can start.LOCAL_STUDIO_CORS_ORIGINS.ForwardedorX-Forwarded-Host; forwarded-host deployments require a separate explicit trust policy.Current-main refresh
The reviewed issue head
cca1a89b259facefcf64fa48f4227f6a1439cfedwas rebased through the reviewed PR #244 dependency at exact head3cdd3a6402308c1d7a25816205cdedd7e73688f6onto currentmainat08bcba27f137f9c3d0206ea811d0aa7548a2dfa6, producing exact headfa8f537ad3ac7d7731475b84f3f8b55027f50031.The two conflict resolutions preserve main's Effect runtime architecture:
controllerRuntimeMiddleware(runtime)remains the first application middleware.createKeylessRequestGuardMiddleware(context)is immediately second.effectMiddlewareand interruptible controller runtime execution.The integration suite moved from
controller/src/http/security-middleware.test.tstocontroller/tests/integration/security-boundary.test.ts, withcontroller/tests/tsconfig.jsonproviding strict test typing while keeping async test harness code outside the production standards scan.Patch identity for the previously reviewed issue commits is unchanged:
9882d98->72abef6f4daccddbd8fb98260c7fce4cd6ef03ffcca1a89->ae952844d5c6c448753c9e497be2f03aa44280acValidation
The normal pre-push hook passed conventional-commit validation and the complete frontend quality/production-build gate while publishing
fa8f537ad3ac7d7731475b84f3f8b55027f50031.Because the stacked dependency touches frontend package metadata, the production desktop distribution was also rebuilt and installed under the repository reinstall lock. The canonical
/Applications/Local Studio.appverifies with a strict recursive hardened-runtime signature, retains bundle IDorg.local.studio.desktop, and returned{"ok":true}from/api/desktop-healthon repeated host-level probes.UI changes
No visible UI changes. The frontend delta is limited to the reviewed one-line dependency cleanup from PR #244.
Risks / rollout notes
Keyless wildcard and LAN deployments must enumerate the exact authorities clients use. API-key deployments retain their existing authentication boundary. Reverse proxies are not trusted implicitly: deployments requiring forwarded-host semantics need a separate explicit trust policy rather than accepting client-supplied forwarding headers.
Workflow state
The refreshed fork-PR workflows require maintainer approval: