-
Notifications
You must be signed in to change notification settings - Fork 0
[WRONG BRANCH] security: block loopback-bootstrapped GUI sessions from mutating machine state #410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: Dev
Are you sure you want to change the base?
Changes from all commits
d35592b
71c57ea
d560ac6
08ada6f
ec51e42
e25b653
80fff9a
fc4de77
c7d8407
54e2274
2c4dca1
a34e8b7
ebb4d55
682112e
af6113a
847f4f1
ac78647
aaa9eaf
35ff3a4
88613a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,6 +111,14 @@ export function startMachineListener( | |
| if (managementPrincipal(req, managementAuth, config) !== "gui-session") { | ||
| return Response.json({ error: "opencodex machine GUI session required" }, { status: 401 }); | ||
| } | ||
| // A loopback dashboard session proves possession, not user presence: any local | ||
| // process can fetch the dashboard bootstrap and replay its token and CSRF value. | ||
| // Keep the connected listener useful for status/diagnostics, but never let that | ||
| // credentialless bootstrap authorize durable machine changes. Those operations | ||
| // remain available through the explicit CLI commands. | ||
| if (req.method !== "GET" && req.method !== "HEAD") { | ||
| return Response.json({ error: "opencodex machine changes require the local CLI" }, { status: 403 }); | ||
|
Comment on lines
+119
to
+120
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the dashboard is served by a connected client, it still exposes actions that POST to these machine endpoints: disconnect in AGENTS.md reference: AGENTS.md:L343-L344 Useful? React with 👍 / 👎. |
||
| } | ||
| return await handleMachineApi(req, url, connection, machineApiDeps) ?? json404(req); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Support
HEADin both machine routing and machine API handling.machineRouteAllowedrejectsHEADfor/api/machine/status,/api/machine/clients, and/api/machine/shimbefore the GUI-session guard runs. However,handleMachineApialso matches onlyGETfor these paths. AllowingHEADonly inmachineRouteAllowedstill reacheshandleMachineApi, returnsnull, and produces a 404. IfHEADis supported, update both files to use the read-only response path and add a focusedHEAD /api/machine/statustest.🤖 Prompt for AI Agents