Register detector and correlation-rule indices as system indices#1749
Register detector and correlation-rule indices as system indices#1749DarshitChanpura wants to merge 2 commits into
Conversation
Onboards .opensearch-sap-detectors-config and .opensearch-sap- correlation-rules-config as OpenSearch system indices. This is a prerequisite for onboarding security-analytics to the centralized resource-sharing framework, which requires resource indices to be declared as system indices. Registering these as system indices means all internal access must run under a stashed (system) thread context when the security plugin is enabled. Fixes the access sites that were not already stashing: - TransportIndexCorrelationRuleAction: stash at start of async flow (covers create-index, mapping-update, and write) - TransportDeleteCorrelationRuleAction: stash around delete-by-query - TransportDeleteRuleAction: stash around the detectors index search - DetectorUtils.getAllDetectorInputs: stash around the detectors search Reuses the existing StashedThreadContext.run() helper. Detector CRUD transport actions already stashed context, so they are unaffected. Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit 8b15a78.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
PR Reviewer Guide 🔍(Review updated until commit 8b15a78)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 8b15a78
Previous suggestionsSuggestions up to commit 80a5bf1
|
Now that the detector and correlation-rule config indices are system indices, searching them by concrete name requires the super-admin (adminDN cert) client. The test framework's client() is a regular admin/admin user, whose system-index search results are scoped out (returns empty rather than erroring), causing ArrayIndexOutOfBounds in tests that read the detectors index directly. - executeSearch now uses adminClient() when security is enabled (covers 15 test files that search the detector/correlation indices) - Replace 5 hard-coded ".opensearch-sap-detectors-config/_search" calls in DetectorRestApiIT with adminClient() Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
|
Persistent review updated to latest commit 8b15a78 |
Description
Onboards
.opensearch-sap-detectors-configand.opensearch-sap-correlation-rules-configas OpenSearch system indices.This is a prerequisite for onboarding security-analytics to the centralized resource-sharing framework (#1735). The resource-sharing framework requires resource indices to be declared as system indices so the security plugin can apply document-level access control and grant the plugin's own subject access.
Changes
Production:
SecurityAnalyticsPlugin.getSystemIndexDescriptorsStashedThreadContext.run()helper):TransportIndexCorrelationRuleAction— stash at start of async flow (create-index, mapping-update, write)TransportDeleteCorrelationRuleAction— delete-by-queryTransportDeleteRuleAction— detectors index searchDetectorUtils.getAllDetectorInputs— detectors index searchTesting / known follow-ups
Registering these as system indices changes how security-enabled integration tests must read the indices — tests that search the detectors index directly via the REST client need to be updated to a system-index-capable read path. Iterating on those test updates in this PR.
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.