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
sql: gate SHOW SCHEDULES behind VIEWJOB system privilege
Previously, `SHOW SCHEDULES` was implicitly gated by `SELECT` on
`system.scheduled_jobs` and `system.jobs`, which only `admin` has by
default. This made it impossible to grant schedule visibility to
non-admin users without granting broad access to system tables.
This change gates `SHOW SCHEDULES` behind the existing `VIEWJOB`
system privilege (which already controls job visibility and is a
natural fit for schedule visibility). Admin users satisfy this check
implicitly through `ALL` privileges. The privilege also grants implicit
`SELECT` on `system.scheduled_jobs` and `system.jobs` so the delegated
query executes successfully.
The delegator performs an upfront privilege check (rather than relying
solely on the authorization.go fallback) because without it the user
would see a confusing "does not have SELECT privilege on relation
scheduled_jobs" error instead of a clear message about the VIEWJOB
privilege. The check properly distinguishes InsufficientPrivilege from
transient errors to avoid swallowing operational failures.
On the DB Console side, the schedules API now checks for SQL execution
errors before accessing results, preventing runtime crashes when the
user lacks the required privilege.
Fixes: #169420
Epic: none
Release note (sql change): `SHOW SCHEDULES` now requires the `VIEWJOB`
system privilege. Non-admin users can be granted schedule visibility via
`GRANT SYSTEM VIEWJOB TO <user>` without needing direct `SELECT` on
system tables.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments