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

don't replace detector user when update #126

Merged
merged 2 commits into from
Jul 15, 2021

Conversation

ylwu-amzn
Copy link
Collaborator

Signed-off-by: Yaliang Wu ylwu@amazon.com

Description

In current implementation, when user update detector, we will replace detector user as current user. In some cases, it may cause detector creator lose access of detector. Check more details in #124
Based on discussion with @skkosuri-amzn and PM, we plan to fix this issue quickly by blocking replacing detector user when update. User can't update detector user after creation.

Issues Resolved

#124

Check List

  • 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.

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
@ylwu-amzn ylwu-amzn added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels Jul 14, 2021
@codecov-commenter
Copy link

codecov-commenter commented Jul 14, 2021

Codecov Report

Merging #126 (1da4bef) into main (ea22d59) will increase coverage by 0.37%.
The diff coverage is 60.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #126      +/-   ##
============================================
+ Coverage     75.97%   76.35%   +0.37%     
- Complexity     2886     2896      +10     
============================================
  Files           264      264              
  Lines         12435    12431       -4     
  Branches       1222     1221       -1     
============================================
+ Hits           9448     9492      +44     
+ Misses         2478     2421      -57     
- Partials        509      518       +9     
Flag Coverage Δ
plugin 76.35% <60.00%> (+0.37%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...transport/IndexAnomalyDetectorTransportAction.java 72.46% <36.36%> (-1.83%) ⬇️
...c/main/java/org/opensearch/ad/util/ParseUtils.java 63.71% <70.00%> (+9.96%) ⬆️
...d/transport/AnomalyDetectorJobTransportAction.java 88.57% <100.00%> (ø)
...ransport/DeleteAnomalyDetectorTransportAction.java 48.91% <100.00%> (ø)
...d/transport/GetAnomalyDetectorTransportAction.java 57.55% <100.00%> (ø)
...ansport/PreviewAnomalyDetectorTransportAction.java 82.66% <100.00%> (ø)
...java/org/opensearch/ad/task/ADBatchTaskRunner.java 87.82% <0.00%> (-0.87%) ⬇️
...port/SearchAnomalyDetectorInfoTransportAction.java 59.09% <0.00%> (+4.54%) ⬆️
.../main/java/org/opensearch/ad/cluster/HashRing.java 84.21% <0.00%> (+5.26%) ⬆️
... and 2 more

@@ -102,7 +102,7 @@ protected void doExecute(Task task, AnomalyDetectorJobRequest request, ActionLis
detectorId,
filterByEnabled,
listener,
() -> executeDetector(listener, detectorId, seqNo, primaryTerm, rawPath, requestTimeout, user),
(anomalyDetector) -> executeDetector(listener, detectorId, seqNo, primaryTerm, rawPath, requestTimeout, user),
Copy link
Contributor

Choose a reason for hiding this comment

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

Curiously, it seems the anomalyDetector was not used in the executeDetector method?

Copy link
Collaborator Author

@ylwu-amzn ylwu-amzn Jul 14, 2021

Choose a reason for hiding this comment

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

Yes, actually the executeDetector will get detector with detectorId. This PR is mainly to fix the security issue. Will refactor code in separate PR to reuse detector rather than query it again. Will add some TODO to make it clear

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Create an issue to track this #127

Copy link
Contributor

@spbjss spbjss left a comment

Choose a reason for hiding this comment

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

looks good to me

Copy link
Member

@saratvemulapalli saratvemulapalli left a comment

Choose a reason for hiding this comment

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

Had a chat with @ylwu-amzn , not really happy with the path from the customer perspective.
But I agree security comes first.

Thanks for the changes, they look good to me!

@ylwu-amzn ylwu-amzn merged commit 08d8df3 into opensearch-project:main Jul 15, 2021
ohltyler pushed a commit to ohltyler/anomaly-detection-2 that referenced this pull request Sep 1, 2021
* don't replace detector user when update

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong doc link
ohltyler pushed a commit to ohltyler/anomaly-detection-2 that referenced this pull request Sep 1, 2021
* don't replace detector user when update

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong doc link
ohltyler pushed a commit that referenced this pull request Sep 1, 2021
* don't replace detector user when update

Signed-off-by: Yaliang Wu <ylwu@amazon.com>

* fix wrong doc link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants