- Java 99.9%
* 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> |
||
|---|---|---|
| .github | ||
| build-tools | ||
| checkstyle | ||
| formatter | ||
| gradle | ||
| release-notes | ||
| scripts | ||
| src | ||
| .codecov.yml | ||
| .gitignore | ||
| .licenserc.json | ||
| .whitesource | ||
| build.gradle | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| DEVELOPER_GUIDE.md | ||
| gradlew | ||
| gradlew.bat | ||
| LICENSE | ||
| MAINTAINERS.md | ||
| NOTICE | ||
| README.md | ||
| security-analytics-commons-1.0.0.jar | ||
| settings.gradle | ||
- OpenSearch Security Analytics
- Highlights
- Documentation
- Contributing
- Code of Conduct
- Security
- License
- Copyright
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
Copyright OpenSearch Contributors. See NOTICE for details.