fix: name the denied resource in SQL forbidden errors #20980
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.37) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 228 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.325
Real PR Conversation Timeline
1 comments
"Review active on #20980"
general
weight: 0.35
FrankChen021
Description
A denied SQL query does not say which permission is missing, so neither the user nor the admin knows what to grant.
Before:
After:
Release note
The 403 error for a denied SQL query now names the missing permission, for example
Unauthorized: user[frank] has no WRITE permission on resource type[DATASOURCE] name[wikipedia] in authorizer[basic]. ....This applies to
/druid/v2/sql, JDBC,/druid/v2/sql/taskand/druid/v2/sql/statements.Clients that compare the error to the exact string
Unauthorizedneed to match on theUnauthorizedprefix instead.With
druid.server.http.errorResponseTransform.strategy=allowedRegex, the detail is shown only if it matches an allowed regex; otherwise the authorizer's own message is shown if it matches, andUnauthorizedif not.Previously the authorizer's own message reached SQL clients without this check.
Security
Only SQL denials name the resource, since every resource the planner checks comes from the query itself.
REST resource filters still return
Unauthorized, because they check resources the caller did not send, such as a task's datasource.Tables the caller cannot read are still reported as not found (
druid.sql.planner.authorizeTableVisibility).<hr>
This PR has: