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
fix(consent): key the star guard on the authenticating credential, not headers
The agent-consent refusal on POST /api/github/star asked whether the request
carried an Origin plus the GUI-origin and CSRF headers, on the stated premise
that requireManagementAuth had already matched them against a minted session.
It had not. The gate accepts a raw admin token and returns BEFORE it consults
the session table, so those headers were never validated for a token-authorized
call, and the admin token is readable by anything running as the user, which is
precisely the caller this guard exists to refuse. Three headers with arbitrary
values were enough to star the repository with the user's identity.
managementPrincipal() now resolves which credential passed the gate, from the
same session table and the same CSRF comparison the gate uses, and the server
passes it into the management dispatcher. The route asks for a gui-session
principal: a session this process minted for a browser, which is only accepted
for a mutation after origin and per-session CSRF both match. An unresolved
principal (direct dispatch in tests, any future internal caller) is untrusted.
Behavior for real users is unchanged: dashboard clicks still star, hand-typed
runs still star, and the non-loopback operator dashboard on a raw admin token
keeps the documented fail-closed edge. Both regressions were driven red against
the old header check.
0 commit comments