Skip to content

fix(server/grants): refuse refresh for a locked account - #5199

Merged
nabokihms merged 1 commit into
dexidp:masterfrom
tlq5l:fix/refresh-locked-account
Nov 25, 2026
Merged

nabokihms merged 1 commit into
dexidp:masterfrom
tlq5l:fix/refresh-locked-account

Conversation

@tlq5l

@tlq5l tlq5l commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Overview

With sessions enabled, an account that is locked after login keeps getting new tokens from its refresh token, because the refresh grant never checks BlockedUntil. Part of #5176.

What this PR does / why we need it

After it loads the stored UserIdentity, the refresh grant now answers invalid_grant ("Account is locked until ...") while BlockedUntil is in the future, the same response the password grant gives. Once the lock is cleared, a refresh token that has not expired works again.

TestRefreshLockedAccountDenied fails on master: the locked account gets a 200 with new tokens. go test ./server/... and go vet ./server/... pass.

Special notes for your reviewer

This is the refresh half of the second bullet in #5176. The password grant already refuses a locked account since #5168. The gRPC call to lock and unlock an identity is not in this PR.

With sessions enabled, the refresh grant loads the stored user identity
but never read BlockedUntil, so an account locked after login kept
getting new tokens. Answer invalid_grant while the lock is in the
future, the same way the password grant does.

Refs dexidp#5176

Agent: claude
Signed-off-by: Terry <186405119+tlq5l@users.noreply.github.com>

@nabokihms nabokihms left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM!

@nabokihms
nabokihms merged commit fdfd6b1 into dexidp:master Nov 25, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants