Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes to prevent creating two detectors with same name #261

Closed

Conversation

raj-chak
Copy link
Contributor

@raj-chak raj-chak commented Jan 10, 2023

Signed-off-by: Raj Chakravarthi [email protected]

Description

changes to prevent creating two detectors with same name
Updated PR with a new approach. This approach uses name as the id for detector and onus is not on elasticsearch to generate id for detector after this change.

Issues Resolved

(#207)

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --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.

@raj-chak raj-chak requested a review from a team January 10, 2023 22:11
@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2023

Codecov Report

Merging #261 (cb1265f) into main (78ea8be) will decrease coverage by 0.21%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##               main     #261      +/-   ##
============================================
- Coverage     36.96%   36.75%   -0.21%     
  Complexity      887      887              
============================================
  Files           179      179              
  Lines          7010     7055      +45     
  Branches        855      859       +4     
============================================
+ Hits           2591     2593       +2     
- Misses         4182     4225      +43     
  Partials        237      237              
Impacted Files Coverage Δ
...securityanalytics/mapper/IndexTemplateManager.java 0.00% <0.00%> (ø)
...search/securityanalytics/mapper/MapperService.java 4.61% <0.00%> (+0.06%) ⬆️
...lytics/transport/TransportIndexDetectorAction.java 0.00% <0.00%> (ø)
...rch/securityanalytics/rules/objects/SigmaRule.java 91.20% <0.00%> (+0.19%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@raj-chak raj-chak force-pushed the detector-with-same-name branch from d3877dc to 8d3d36d Compare January 11, 2023 02:01
getsaurabh02
getsaurabh02 previously approved these changes Jan 11, 2023
Comment on lines 698 to 699
//if (detectorIndices.detectorIndexExists()) {
if (false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition looks weird. Can we fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accident, will revert

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that "if (false) {" to make sure it wasnt my code that caused a bad integration test @getsaurabh02, reverted

QueryBuilders.nestedQuery(
"detector",
QueryBuilders.boolQuery().must(
QueryBuilders.matchQuery(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move this logic out to a helper method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit difficult at the last moment as it uses listeners.

@eirsep
Copy link
Member

eirsep commented Jan 11, 2023

will this work if 2 concurrent requests are made ?

riysaxen-amzn pushed a commit to riysaxen-amzn/security-analytics that referenced this pull request Feb 20, 2024
* [Cypress] Fix cypress flaky tests for findings opensearch-project#242

Signed-off-by: Jovan Cvetkovic <[email protected]>

* [Cypress] Fix cypress flaky tests for findings opensearch-project#242

Signed-off-by: Jovan Cvetkovic <[email protected]>

* [Cypress] Fix cypress flaky tests for findings opensearch-project#242

Signed-off-by: Jovan Cvetkovic <[email protected]>

* [Cypress] Fix cypress flaky tests for findings opensearch-project#242

Signed-off-by: Jovan Cvetkovic <[email protected]>

Signed-off-by: Jovan Cvetkovic <[email protected]>
@praveensameneni
Copy link
Member

@sbcd90 , @jowg-amazon , can you please review as we need this change - should not have detectors with same name as it will be a confusing experience.

@sbcd90 sbcd90 closed this Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants