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
[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.
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".
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.
Activity
EVWorth commentedon Aug 29, 2026
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 tomysql.userdoes 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.userfails (MariaDB lacks some of those columns, and a restricted grant may expose only some)SELECT DISTINCT User, Host FROM mysql.usersucceedsThe 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
warninstead of discarding it.Retitling suggestion: "fetchUsers fallback silently presents unknown lock/expiry state as normal".
fix(admin): keep privilege edits per database, and admit unknown user…
EVWorth commentedon Aug 29, 2026
Done in #524. Accounts whose lock/expiry state could not be read now show an explicit
unknownmarker 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.
feat(admin): edit a user, not only its password (#621)