Repository navigation
fix(authz): keep a rotated refresh token valid for a short grace window CU-17tkuw62gnb - #2919
Conversation
🦩 Flamingo Code Review✅ Tests and checks passed on this commit (2 lanes). 4 findings: 🔴 1 action required · 🟠 1 recommended · 🔵 2 informational Advisory: findings do not block the merge. Rules cited:
🔴 Action required (1)
🟠 Recommended (1)
🔵 Informational (2)
✅ What this change does well
Inline comments: 4 new 7 possible problems checked and ruled out
🧪 Tests and mutationTests per lane
Java tests passed on all changed modules: 1155 run, 0 failed, 204 skipped. MongoOAuth2AuthorizationRepositoryIT is among the skipped unless integration.tests=true; it passed when run by hand with real Mongo. Mutation testingThis build has no PIT plugin, so each module is mutated from the command line with pit-adhoc.sh, changing nothing in the repository.
New code, its covering tests and the result
The covering tests by name (17 methods)
What the surviving mutations leave unverified
1 mutant on lines this change added is not caught (1 survived, 0 with no test reaching it): each is annotated on its line in the 1 gap (not tested here):
🤖 Prompt for AI agents: fix every findingNext: commit a suggestion, or hand a comment's prompt to your coding agent. React 👍 on a finding that helped and 👎 on one that is wrong: the reviewer learns from both. Review again. New commits are not reviewed until you ask:
Or comment Started 2026-11-01 23:15 UTC · updated 2026-11-01 23:25 UTC · reviewed from Aliaska Varieva's machine |
Problem
A refresh token works once. Rotation overwrites it in Mongo, and the client learns the new value only from the response. If that response is lost (reload, closed tab, dropped connection), the client keeps a token that matches nothing, and every later refresh returns 401. Reproduced on prod by aborting
POST /oauth/refreshmid-flight.Fix
retiredRefreshTokenson the same authorization.findByTokenaccepts a retired token for 60s (openframe.authz.refresh-token-grace-seconds), so a retry rotates normally. It's a list, so a retry that rotates again doesn't kill a token another request just received.retiredRefreshTokens.value, inMongoIndexConfigand on the document.Testing
MongoOAuth2AuthorizationRepositoryITcovers the nested query and index on real Mongo (run with-Dintegration.tests=true).Limits
Rollout
Needs an oss-lib release, then bumps in
openframe-saas-sharedfor the auth-server and the user-gateway, which is pinned separately on prod. Deploy the auth-server first. An older auth-server ignores and drops the new field, so rollback is safe.Change-Set: fix-cu-17tkuw62gnb
Change set
flamingo-stack/fix-cu-17tkuw62gnb: this pull request is the only one in it so far. Another pull request joins by naming this one in aDepends-Online, or by carrying the sameChange-Setline.Linked work
Linked by the
Depends-On/Change-Setlines in these descriptions; this block is maintained by the hub.