fix(oidc): fix OIDCAdapter broken flows#7837
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Review Summary by QodoFix critical bugs in OIDCAdapter memory storage flows
WalkthroughsDescription• Fixed unsafe null assertions in destroy() and consume() methods • Added missing grantId and userCode index management in upsert() • Fixed stale userCode mapping leak by deleting entries in destroy() • Improved type safety and code formatting throughout adapter Diagramflowchart LR
A["destroy method"] -->|"safely handle null"| B["Check grantId existence"]
B -->|"delete userCode mapping"| C["Clean up storage"]
D["consume method"] -->|"validate payload exists"| E["Update consumed timestamp"]
F["upsert method"] -->|"index grantId"| G["Track grant tokens"]
F -->|"index userCode"| H["Map userCode to id"]
G -->|"enable"| I["revokeByGrantId"]
H -->|"enable"| J["findByUserCode"]
File Changes1. src/node/security/OIDCAdapter.ts
|
Code Review by Qodo
1. No regression test added
|
|
Thanks for picking this up — the core fix is correct and overdue. The pre-fix Strong points
Requested changes before merge1. storage.set(key, payload); // no ttl arg → falls back to constructor ttlThis silently overrides the 2. Add regression tests.
…would lock these in. Given this is OIDC, I'd really like to see this before merge. Notes (not blockers)
Nice catch on a real security-relevant bug. Approving in spirit pending the |
|
Thanks for the mr. That really fixed an issue as described by John ^^ |
I am glad that I was useful to you |
Fixed critical bugs in MemoryAdapter that broke grant revocation, device flow, and token consumption, missing grantId/userCode indexes in upsert, unsafe null …Fixed critical bugs in MemoryAdapter that broke grant revocation, device flow, and token consumption, missing grantId/userCode indexes in upsert, unsafe null assertions in destroy and consume, and a stale userCode mapping leak.