You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(authserver): max-failures-before-lock and default-lock-duration-minutes are documented but never applied #353
Found in the round-2 review of #350 (#345). Pre-existing; for #344 part 3.
Problem
OAuth2ClientManagementConfig has max-failures-before-lock (10) and default-lock-duration-minutes (60), and OAUTH2_CLIENT_MANAGEMENT_API.md ("Configuration") documents them under espi.oauth2.client-management. No code reads either one:
Nothing counts a client's authentication failures or locks the client after them (failure_count is read by client management, never written).
A suspension without lock_duration_minutes lasts until the client is set active again. It does not end after the default 60 minutes.
Since #350, a timed suspension really does end on its own, so an operator who sets default-lock-duration-minutes may well expect a suspension to end after it.
Fix
Either remove both properties and their docs (and failure_count from the responses if nothing will write it), or implement them: lock a client for default-lock-duration-minutes after max-failures-before-lock failed client authentications, with tests. With #344 part 3, which reworks this API.
Constraint from PR #350 (#345, review round 3): a lock only ever restricts.
ClientStatusService treats locked_until as a lock that ends on its own. It suspends an active client while it runs, and it never ends a stored suspended or revoked. A timed suspension (lock_duration_minutes) is therefore stored as client_status = 'active' plus locked_until. So no write to locked_until can let a client in.
A failure lockout built for this issue must keep that property:
It must only set or extend a lock, never shorten one. That's so it can't cut short an administrator's timed suspension. Write it as locked_until = GREATEST(COALESCE(locked_until, ?), ?), binding the current time and the new end. The COALESCE is needed because GREATEST treats NULL differently on MySQL and PostgreSQL.
It must not write client_status.
An administrator setting the client active clears the lock, as today.
If a lockout ever needs to be reported separately from a timed suspension, give it its own column rather than reusing locked_until with a different meaning.
Activity
dfcoffin commentedon Nov 29, 2026
Constraint from PR #350 (#345, review round 3): a lock only ever restricts.
ClientStatusServicetreatslocked_untilas a lock that ends on its own. It suspends anactiveclient while it runs, and it never ends a storedsuspendedorrevoked. A timed suspension (lock_duration_minutes) is therefore stored asclient_status = 'active'pluslocked_until. So no write tolocked_untilcan let a client in.A failure lockout built for this issue must keep that property:
locked_until = GREATEST(COALESCE(locked_until, ?), ?), binding the current time and the new end. TheCOALESCEis needed becauseGREATESTtreats NULL differently on MySQL and PostgreSQL.client_status.activeclears the lock, as today.If a lockout ever needs to be reported separately from a timed suspension, give it its own column rather than reusing
locked_untilwith a different meaning.