Skip to content

fix(authserver): max-failures-before-lock and default-lock-duration-minutes are documented but never applied #353

Backlog

Description

@dfcoffin

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.

Activity

  1. dfcoffin commented on Nov 29, 2026

    @dfcoffin
    ContributorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions