Compare commits

...
Author SHA1 Message Date
Cursor Agent 87ff841023 Fix revoke race returning stale approved status and clear last_seen_at on re-register
Bug 1: In client-approval mode, when markSeen returns None (because the
client was revoked/rejected between upsert and markSeen), the fallback
incorrectly returned status 'approved'. Now returns 'rejected' to prevent
credential minting for revoked/rejected clients.

Bug 2: The upsert conflict path for revoked clients cleared status,
approved_at, rejected_at, and revoked_at but never cleared last_seen_at,
causing stale 'Last connected' times after re-registration. Now resets
last_seen_at to NULL when a revoked client re-registers.
2026-06-27 14:35:28 +00:00
2 changed files with 5 additions and 1 deletions

No files matched your search

+1 -1
View File
@@ -333,7 +333,7 @@ export const make = Effect.gen(function* () {
return { mode, status: "approved" as const, client: seenClient };
}
return { mode, status: "approved" as const, client: visibleClient };
return { mode, status: "rejected" as const, client: visibleClient };
});
const updateDecision = <E extends ConnectClientApprovalError | ConnectClientRejectionError>(
@@ -256,6 +256,10 @@ export const make = Effect.gen(function* () {
WHEN auth_connect_clients.revoked_at IS NULL THEN auth_connect_clients.rejected_at
ELSE NULL
END,
last_seen_at = CASE
WHEN auth_connect_clients.revoked_at IS NULL THEN auth_connect_clients.last_seen_at
ELSE NULL
END,
revoked_at = NULL
RETURNING ${sql.unsafe(rowSelection)}
`,