Skip to content

AS PostgreSQL reporting views count a client on a timed suspension or lock as active #355

Backlog

Description

@dfcoffin

Found in the round-4 review of PR #350 (#345).

Problem

PR #350 stores a timed suspension (lock_duration_minutes) as client_status = 'active' with locked_until set: a lock only ever restricts, and a stored suspended never ends on its own. The Authorization Server applies the status in force through ClientStatusService.

PostgreSQL's reporting objects filter on the stored status alone, so they treat a client on a timed suspension, or under any running lock, as active:

  • v_active_clients: V3_0_0__add_default_data_and_test_clients.sql line 298
  • v_security_monitoring: V3 line 329
  • check_security_violations(): V3 lines 351 and 365
  • v_active_client_certificates: V6_0_0__add_certificate_authentication_support.sql line 211
  • The partial index idx_v_active_clients_status (V3 line 381) uses the same predicate.

No Java code reads these objects, so this affects only DBA and monitoring queries. Enforcement is unaffected.

Fix

Choose one, in a new PostgreSQL migration:

  • add AND (c.locked_until IS NULL OR c.locked_until <= CURRENT_TIMESTAMP) to each filter, or report the status in force the way ClientStatusService.STATUS_IN_FORCE_SQL does;
  • or drop the objects if nothing is meant to use them.

Check whether the MySQL scripts (V3 to V6, which are .disabled, #145) have the same objects before they are re-enabled.

Belongs with #344 part 3, with #351 (the other PostgreSQL schema work). Before deployment, it should be noted that #352 affects which migrations run.

Activity

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