Skip to content

Commit 87ff841

Browse files
committed
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.
1 parent 4f4335b commit 87ff841

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎apps/server/src/auth/ConnectClientStore.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ export const make = Effect.gen(function* () {
333333
return { mode, status: "approved" as const, client: seenClient };
334334
}
335335

336-
return { mode, status: "approved" as const, client: visibleClient };
336+
return { mode, status: "rejected" as const, client: visibleClient };
337337
});
338338

339339
const updateDecision = <E extends ConnectClientApprovalError | ConnectClientRejectionError>(

‎apps/server/src/persistence/AuthConnectClients.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ export const make = Effect.gen(function* () {
256256
WHEN auth_connect_clients.revoked_at IS NULL THEN auth_connect_clients.rejected_at
257257
ELSE NULL
258258
END,
259+
last_seen_at = CASE
260+
WHEN auth_connect_clients.revoked_at IS NULL THEN auth_connect_clients.last_seen_at
261+
ELSE NULL
262+
END,
259263
revoked_at = NULL
260264
RETURNING ${sql.unsafe(rowSelection)}
261265
`,

0 commit comments

Comments
 (0)