You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 31b47dd
Browse filesBrowse the repository at this point in the historyBrowse files
feat(consent): refuse agent-driven stars on every surface, not just the CLI
The CLI already deferred the one-time star prompt to the user when an agent was
driving `ocx start`. That deferral was bypassable: `POST /api/github/star` had no
such guard, and a coding agent runs on the user's machine, where it can read
`~/.opencodex/admin-api-token` off disk. One curl starred the repository with the
user's GitHub identity, having asked nobody.
Holding the admin token proves the caller reached a secret, not that a person
chose to spend their own account. Gate the write on consent instead:
- The star POST now returns 403 `agent_consent_required` for agent-driven callers
and, decisively, never spawns `gh` — a refusal that still performed the write
would be theatre. The response names the command to run after a real yes.
- A dashboard click keeps working even when an agent started the proxy, which is
the common case: the person is at the browser, not at the spawning shell. The
click is recognized by its browser-session evidence (same-origin Origin plus the
minted CSRF/GUI-origin headers the auth gate already verified), not by the
proxy's own environment.
- Agent detection widens from 11 vars to 23 (Cline, Roo, Windsurf, opencode,
Gemini CLI, GitLab/Buildkite/Jenkins/TeamCity/Codespaces). A false positive only
postpones a prompt; a false negative lets an agent answer for the user.
`CODEX_HOME` is deliberately excluded — users export it from their own shell
profile, so matching it would silence the prompt for a person at the keyboard.
- The CLI deferral now states the rule an agent tends to rationalize past: do not
infer consent from the surrounding task.
Known edge, failing closed: a non-loopback operator dashboard authenticates with
the raw admin token and sends no CSRF header, so if that proxy was also started
from an agent shell the button is refused and points at the `gh` one-liner. A
service-run proxy carries OCX_SERVICE and is not agent-driven, so the usual
remote setup is unaffected.
Documented in AGENTS.md as a general class ("user-consent actions") rather than a
one-off, plus README and the English/Korean dashboard guides.
Coverage: the route guard was driven red by neutralizing its condition, which
failed exactly the refusal test and nothing else. typecheck, privacy:scan,
lint:gui, and the full suite (6749 pass / 0 fail) are green.
|`GET` / `POST /api/github/star`| Read the `gh`-derived star state, or star the repository. The POST is refused with `403``agent_consent_required` for agent-driven callers without a dashboard session. |
|`POST /api/startup-action`| Install the background service or Codex launcher shim through fixed, allowlisted actions. |
126
148
|`GET` / `POST /api/windows-tray`| Read or change the Windows tray installation and visible-process state. POST accepts `install`, `start`, `stop`, or `uninstall`. |
0 commit comments