Skip to content

[fix] validate sql reaching the alert query executor - #4275

Open
Duansg wants to merge 1 commit into
apache:masterfrom
Duansg:fix-alert-preview-sql-validation
Open

[fix] validate sql reaching the alert query executor#4275
Duansg wants to merge 1 commit into
apache:masterfrom
Duansg:fix-alert-preview-sql-validation

Conversation

@Duansg

@Duansg Duansg commented Jul 29, 2026

Copy link
Copy Markdown
Member

What's changed?

Apply read-only validation at the point where SQL reaches the executor, and fix the validator's handling of multiple statements.

Checklist

  • I have read the Contributing Guide
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

Add or update API

  • I have added the necessary e2e tests and all cases have passed.

@zqr10159

Copy link
Copy Markdown
Member

This is useful executor-level read-only validation, but it does not close the complete alert-query exposure. Low-privilege callers can still issue broad telemetry reads, expensive SELECTs, and raw PromQL; SELECT-only parsing also permits unions/subqueries across available tables. Please add an authorization/ownership boundary for preview and authoring, scope readable sources/tables, and enforce time/range/cost limits for both SQL and PromQL. I would treat the current patch as one defense-in-depth layer, not a complete remediation.

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.

2 participants