mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-12-05 16:07:33 +00:00
RefreshTokenPair read the token and deleted it in two Redis calls. Two concurrent requests with the same refresh token both passed the read and validation, so both could mint a new token pair, keeping a stolen token alive across rotations. Add an atomic ConsumeRefreshToken (Lua GET+DEL) and require rotation to win that consume. Losers get ErrRefreshTokenInvalid; Redis errors now fail closed instead of issuing a new pair without invalidating the old token.