Security Analytics enables users for detecting security threats on their security event log data. It will also allow them to modify/tailor the pre-packaged solution.
Find a file
Darshit Chanpura cb18110f26
Register more Security Analytics system indices and run their calls as the plugin subject (#1852)
* Run correlation system index access as the plugin subject

The correlation rule search, create and delete actions and the correlation
alert get and acknowledge actions stashed the thread context to reach the
correlation rules and correlation alerts indices. Both are registered system
indices, so these actions now run their index work through
SecurityAnalyticsPluginClient, which runs each action as the plugin subject
assigned through IdentityAwarePlugin instead of from a context with no user.

SecurityAnalyticsPluginClient becomes a final subclass of the shared
PluginClient in common-utils, which the alerting plugin bundles at runtime.
CorrelationAlertService and CorrelationRuleIndices take it by type, so the
correlation engine's alert reads and writes run as the subject too. The
correlation rule write no longer puts the authenticated user back on the
thread: the plugin client hands its callbacks the caller's context, so the
user resource sharing records as the owner is already there.

plugin-additional-permissions.yml grants the scroll actions the delete by
query drives itself with, which the security plugin classifies as cluster
permissions.

The detector get and search actions keep their stash, because callers rely
on it lasting into their callbacks, where they call the alerting plugin. The
other stash sites touch indices that are not registered system indices, or
indices and actions of the alerting plugin, and are unchanged.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Test the correlation rule delete paths and the mapping update branch

Adds unit tests for the delete-by-query in TransportDeleteCorrelationRuleAction:
on success the rule is deleted and its alerts searched as the plugin subject with
the caller still the authenticated user, a timed-out delete fails with
REQUEST_TIMEOUT and leaves the alerts, and a failed delete reaches the caller
wrapped with its status. Adds a test for the branch of
TransportIndexCorrelationRuleAction that updates an outdated mapping through the
plugin client before writing the rule. RecordingClient can now fail an action.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Fail a correlation rule delete that reports a failed shard

A delete by query reports a failed shard in the response instead of
failing the request. With only the timed out branch checked, a response
that listed a bulk or a search failure returned acknowledged true and
then marked the rule's alerts as errored, while the rule itself was
still there. The callback now reports the listed failures to the caller,
with the status of the first one, and leaves the alerts alone.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Name the test that covers the plugin permissions file

This plugin asks the alerting plugin's class loader first, so a file of
the same name added by alerting would take the place of this one. The
comment points at the integration test that reads these grants end to
end on the secured job.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Report the highest status a failed correlation rule delete lists

Taking the status of the first listed failure let a version conflict on
one shard hide a denial on another, and the opposite. Core's own REST
layer for a by query response takes the highest status across both
lists, so the callback does the same. The first listed failure becomes
the cause of the exception, and the callback logs the failure with the
deleted and total counts, which the branch that goes through
SecurityAnalyticsException.wrap already did.

Tests cover a bulk failure, a search failure, both lists together with
the higher status listed second, and a response that both timed out and
lists a failure.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Keep the cause when a correlation alert update fails

The listener logged only the rule id, so the exception that stopped the
alert search was lost. The search runs on the plugin subject now, so a
denial there is worth a stack trace.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Say only what the permissions file test proves

The comment claimed the integration test shows which copy of the file
was loaded. It does not: it shows that the plugin subject holds the
scroll permissions, whichever file granted them.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Trim the correlation rule delete failure path and its tests

A quality pass over the two preceding commits. The failure log line uses
parameterized logging instead of String.format. The five tests of the
failure paths share one helper that runs the delete, asserts the status
and asserts that only the delete by query ran, and the fixtures build a
denial, a bulk failure and a search failure through named factories, so
only what each test varies is in the test. No behaviour changes: all
nine mutations of the failure path still fail exactly the tests they
should.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Say in the log that the delete reported failures

The line read "was not deleted, 1 of 1 documents deleted" for a delete
that removed the rule and still listed a failed shard. It now names the
failures and leaves the counts to say how far the delete got.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Mark the unlistened alert bulk as a follow up

The delete of a correlation rule now reports the failures its own
response lists. The bulk that moves the rule's alerts to the error state
still goes out with no listener, after the delete has answered, so say
so where it is sent.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Register the plugin's remaining indices and run their calls as the plugin

Register the log type, rule, IOC, IOC finding, correlation history and
metadata, and job indices as system indices, and widen the threat intel
descriptor to the feed and alert indices. Move the 20 stash sites that
reached only these indices, and the services they call, onto the plugin
client. The global detector checks of the custom log type actions and the
threat intel monitor search keep a stash around that one call only.

Search and list correlations, and the rule get and delete, now read their
indices through the plugin client. Delete and update by query calls fail
on the failures their responses list, and a deleted correlation rule's
alerts are marked with one update by query that the delete waits for.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Keep the caller-checked and dashboard-read indices unregistered

Leave the custom rules, IOC, IOC finding and correlation history and
metadata indices unregistered, and put every path to them back as it is
on main: the rule delete and the correlation search and list read them
as the caller, and the sites that stash on main keep their stash.

Refuse, with 400, a caller query that reads other documents while it is
rewritten in the log type, threat intel source config and rule searches,
and pin the rule search to the rules index of the request. Reserve log
type names whose detector indices would match a registered pattern.

The alert update by query proceeds on version conflicts, and its
listeners and those of the rule delete and deleteRules complete once.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Check every part of a caller's search source for document reads

Walk each child of a query on its own, including function score filters,
boosting, script score and nested inner hits, and check the post filter,
aggregations and sub aggregations, rescore queries, sort nested filters,
highlight queries and collapse inner hits of the source. Refuse a source
with suggestions. Apply the check to the correlation rule search and pin
it to the correlation rule index.

Move the descriptor list into SecurityAnalyticsSystemIndices, and test
that each search action answers 400 and that a concurrent alert update
does not fail a rule delete.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

* Refuse any geometry query with an indexed shape

Plugin shape queries such as xy_shape share AbstractGeometryQueryBuilder
with geo_shape and read an indexed shape the same way during the
rewrite. The document read check now matches the base class, and says
that a new query type that reads documents must be added to it.

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>

---------

Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Co-authored-by: Riya <69919272+riysaxen-amzn@users.noreply.github.com>
2026-12-01 17:21:22 -08:00
.github Add SPDX license header checker and missing headers (#1802) 2026-10-12 21:53:57 -04:00
build-tools Add ci.opensearch.org/m2/ mirror for plugin resolution (security-analytics) (#1751) (#1754) 2026-07-31 17:41:40 -04:00
checkstyle [Refactor] rebase to support latest core snapshot (#510) 2023-08-08 14:20:41 -07:00
formatter [Refactor] rebase to support latest core snapshot (#510) 2023-08-08 14:20:41 -07:00
gradle Guard eclipse() to spotless tasks and keep P2 mirror on pinned version (security-analytics) (#1805) 2026-09-10 11:29:46 -04:00
release-notes Add release notes for 3.10.1 (#1865) (#1867) 2026-11-23 22:03:47 -05:00
scripts add build.sh to generate maven artifacts (#87) 2022-10-28 15:35:11 -07:00
src Register more Security Analytics system indices and run their calls as the plugin subject (#1852) 2026-12-01 17:21:22 -08:00
.codecov.yml Add Codecov workflow (#979) 2024-04-12 17:01:54 -07:00
.gitignore add skeleton for the security-analytics plugin (#3) 2022-06-08 11:41:09 -07:00
.licenserc.json Add SPDX license header checker and missing headers (#1802) 2026-10-12 21:53:57 -04:00
.whitesource Add .whitesource configuration file (#96) 2023-04-05 19:00:09 -07:00
build.gradle Fix CVE-2026-102554: Bump guava from 32.1.3-jre to 33.7.2-jre (#1857) 2026-11-20 14:57:55 -05:00
CODE_OF_CONDUCT.md Initial commit 2022-05-10 01:44:18 -04:00
CONTRIBUTING.md Initial commit 2022-05-10 01:44:18 -04:00
DEVELOPER_GUIDE.md Upgrade Lucene Codec to Lucene99 (#800) 2024-01-12 17:10:43 -08:00
gradlew Upgrade gradle to 8.14 and run CI with JDK 24 (#1560) 2025-07-23 14:01:30 -07:00
gradlew.bat Upgrade gradle to 8.14 and run CI with JDK 24 (#1560) 2025-07-23 14:01:30 -07:00
LICENSE Initial commit 2022-05-10 01:44:18 -04:00
MAINTAINERS.md Baselined maintainers list. (#1692) 2026-04-17 11:57:30 -07:00
NOTICE Initial commit 2022-05-10 01:44:18 -04:00
README.md fix code coverage calculation (#980) 2024-05-08 18:33:28 -07:00
security-analytics-commons-1.0.0.jar Update security-analytics-commons jar to netty 4.1.138.Final (#1822) 2026-09-21 18:05:47 -07:00
settings.gradle Add ci.opensearch.org/m2/ mirror for plugin resolution (security-analytics) (#1751) (#1754) 2026-07-31 17:41:40 -04:00

Test Workflow codecov Documentation Chat PRs welcome!

OpenSearch Security Analytics

The OpenSearch Security Analytics aims to enable you to run security operations by automating threat detection and threat analysis on your data. Security analytics plugin will include a threat detection engine that will be pre-loaded with a set of detection rules, that you can customize and extend to alert on standard or custom attack patterns.

Highlights

  • This open-source framework for analyzing the security events will address the cost and complexity associated with running the security operations on your business and infrastructure data.
  • It will enable you to monitor your data, generate findings and send alert notifications automatically to your stakeholders.
  • The security analytics dashboards will let you manage your threats, correlate events and take remediation actions.

Documentation

Please see our documentation [ToDo].

Contributing

See CONTRIBUTING for more information.

Code of Conduct

This project has adopted the Amazon Open Source Code of Conduct. For more information see the Code of Conduct FAQ, or contact opensource-codeofconduct@amazon.com with any additional questions or comments.

Security

If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our vulnerability reporting page. Please do not create a public GitHub issue.

License

This project is licensed under the Apache-2.0 License.

Copyright OpenSearch Contributors. See NOTICE for details.