Skip to content

[P1] [bug] fetchUsers empty catch swallows first query failure silently #440

Closed

Description

@EVWorth

[P1] [bug] fetchUsers silently swallows the first query's failure via empty catch — user has no signal

Context

fetchUsers (UserManagement.tsx:55-99) first tries SELECT User, Host, account_locked, password_expired, password_last_changed FROM mysql.user. On failure, the bare catch { /* Fallback for MariaDB / older MySQL */ } swallows the error and falls through to SELECT DISTINCT User, Host FROM mysql.user.

Problem

Per docs/audits/admin.md F12.

The fallback query succeeds but loses account_locked / password_expired / password_last_changed columns. The user is now looking at a user list with no lock/expired badges and no signal. Percona Server 8.0 has slightly different mysql.user schema (password_require_current added in 8.0.13) — first query may fail and fallback may also fail if user lacks SELECT on mysql.user; user sees unhelpful second error.

Files

  • src/components/admin/UserManagement.tsx:55-99

Repro (if applicable)

Static analysis only.

Expected

On a server that lacks account_locked, UI shows yellow "Limited user info" banner and still renders the user list. On inaccessible mysql.user, error is clear.

Proposed fix

Scope S. Replace bare catch {} with catch (e) { console.warn(...); setError("Some user details unavailable — showing basic list") }. Better: backend list_users tries detailed query first, falls back internally, returns UserList { users, capabilities: { has_locked_field, has_expired_field, has_last_changed } }.

Acceptance

Yellow banner on partial schema support; clear error on full inaccessible.

Needs human verify

Yes

Labels: audit, area/admin, severity/p1, kind/bug

Activity

  1. added
    audit
    severity/p1
    kind/bug
    area/admin
    on Jul 31, 2026
  2. EVWorth commented on Aug 29, 2026

    @EVWorth
    OwnerAuthor

    Narrower than described, but real

    The empty catch is a deliberate fallback with a comment, and a genuine failure is not fully swallowed — when the first query fails, the second one runs and its catch does setError. So a user with no access to mysql.user does see an error.

    The real defect is the case where the two queries disagree:

    • SELECT User, Host, account_locked, password_expired, password_last_changed FROM mysql.user fails (MariaDB lacks some of those columns, and a restricted grant may expose only some)
    • SELECT DISTINCT User, Host FROM mysql.user succeeds

    The UI then renders every user with accountLocked: null, passwordExpired: null, passwordLastChanged: null — silently presenting "unknown" as if it were "not locked / not expired". Nothing tells the user the columns were unavailable or why. On an admin screen, an account that is in fact locked showing as unremarkable is the part that matters.

    Suggested fix: keep the fallback, but record that it was taken and render those columns as an explicit "unavailable on this server" state rather than blank. Log the first error at warn instead of discarding it.

    Retitling suggestion: "fetchUsers fallback silently presents unknown lock/expiry state as normal".

  3. EVWorth commented on Aug 29, 2026

    @EVWorth
    OwnerAuthor

    Done in #524. Accounts whose lock/expiry state could not be read now show an explicit unknown marker rather than rendering identically to a healthy account, and the first error is logged rather than discarded.

    Closing with the correction already noted above: the empty catch did not quite swallow failures — a genuine failure still surfaced from the second query's catch. The real defect was narrower and worse, that the two queries disagreeing produced a confident wrong answer.

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

    area/adminauditkind/bugseverity/p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions