[codex] add session context to credential errors#3349
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Needs human review This PR modifies authentication session handling code (SessionStore.ts) to add context fields to error classes. Changes to auth-related code paths warrant human review regardless of the additive nature of the changes. No code changes detected at You can customize Macroscope's approvability policy. Learn more. |
1ab9e42 to
4c5e0d4
Compare
Co-authored-by: codex <codex@users.noreply.github.com>
4c5e0d4 to
d267a5e
Compare
Summary
Verification
vp test apps/server/src/auth/SessionStore.test.ts(8 tests)vp check(passes with 20 pre-existing warnings)vp run typecheckNote
Medium Risk
Touches session and websocket token verification and revocation error paths in auth; behavior is mostly additive on error shape, but callers that matched on messages or assumed silent revoke success on DB errors may see different failures.
Overview
SessionStore credential and revocation errors now carry structured correlation fields (
sessionId,expiresAt,observedAt,revokedAt, etc.) instead of empty tagged errors that relied on message strings.Verification uses
DateTime.nowfor expiry checks (replacingClock.currentTimeMillis), and invalidexpclaims surfaceInvalidSessionExpirationClaimErrorwithsessionIdand the raw claim. Repository, encoding, and UUID failures are mapped at the call site into typed wrappers (SessionCredentialIssueError,SessionCredentialVerificationError,SessionRevocationError,OtherSessionsRevocationError, and websocket equivalents) with nested causes and session IDs where known.Tests assert on
_tagand context fields (including revoke paths on repository failure) rather than substring messages.Reviewed by Cursor Bugbot for commit d267a5e. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add session context fields to credential and revocation errors in
SessionStoresessionId,expiresAt,observedAt,revokedAt, etc.) to all typed errors in SessionStore.ts, replacing bare string messages.Clock.currentTimeMillistoDateTime.nowfor expiry checks in both session and WebSocket token verification.SessionCredentialIssueError,SessionRevocationError,OtherSessionsRevocationError, etc.) with nested causes.Macroscope summarized d267a5e.