Skip to content

fix: ensure native query statusCode is 403 for blocklist#19745

Open
jtuglu1 wants to merge 1 commit into
apache:masterfrom
jtuglu1:fix-query-blocklist-status-code-bug
Open

fix: ensure native query statusCode is 403 for blocklist#19745
jtuglu1 wants to merge 1 commit into
apache:masterfrom
jtuglu1:fix-query-blocklist-status-code-bug

Conversation

@jtuglu1

@jtuglu1 jtuglu1 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Description

This makes sure that any DruidExceptions thrown during query processing are correctly propagated with the correct status code for native queries.

Release note

Ensure native query statusCode is 403 for query blocklist


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@jtuglu1
jtuglu1 marked this pull request as ready for review July 24, 2026 23:33
@jtuglu1 jtuglu1 added this to the 38.0.0 milestone Jul 24, 2026
@jtuglu1 jtuglu1 added the Bug label Jul 24, 2026
@jtuglu1
jtuglu1 force-pushed the fix-query-blocklist-status-code-bug branch from 6a2bbab to a559622 Compare July 24, 2026 23:37
@jtuglu1
jtuglu1 requested review from kfaraz and maytasm July 24, 2026 23:43
// Handled separately from QueryException so that the exception's own category (for example FORBIDDEN for a
// blocklisted query) determines the status code. Wrapping it below would erase that and report a 500.
return QueryResultPusher.handleDruidExceptionBeforeResponseStarted(
e,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to transform using serverConfig.getErrorResponseTransformStrategy()

return QueryResultPusher.handleDruidExceptionBeforeResponseStarted(
e,
MediaType.valueOf(io.getResponseWriter().getResponseType()),
ImmutableMap.of()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add QUERY_ID_RESPONSE_HEADER to this Map?

@FrankChen021 FrankChen021 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reviewed the code for correctness, edge cases, concurrency, and integration risks; no issues found.

Reviewed 3 of 3 changed files.


This is an automated review by Codex GPT-5.6-Sol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants