The Execute Monitor API (POST /_plugins/_alerting/monitors/_execute) did not
apply the same input validation that the Index Monitor API applies when a
monitor is created. This makes the two paths consistent:
- RestExecuteMonitorAction now calls validateDataSources() so an inline
monitor cannot specify non-default query/findings/alerts indices, matching
the check already performed by RestIndexMonitorAction.
- TransportExecuteMonitorAction now checks that the caller has read access to
the inline monitor's configured input indices before stashing the security
context, mirroring TransportIndexMonitorAction.checkIndicesAndExecute.
Monitors executed by id are unaffected as they are validated at creation.
Signed-off-by: Jeremy Michael <jsusanto@amazon.com>
Description
Add validation to Execute Monitor API
Behavior change
The Execute Monitor API's pre-flight input check now fails the request on any search failure, not only security exceptions. Previously, an inline dry-run against a nonexistent (or otherwise unqueryable) index returned HTTP 200 with the error captured in input_results; it now returns an error response. API consumers relying on the old dry-run debugging behavior should be aware of this.
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.