Access control for results in trigger execution context#1991
Conversation
ffeb432 to
ae99a32
Compare
2594afd to
46f5991
Compare
46f5991 to
9cd1067
Compare
|
Thank you for this PR @markdboyd. I think it makes sense in the current paradigm to add a new cluster setting for this. There is an ongoing effort to re-architect how plugins interface with security through a resource sharing framework based on ownership of a resource and access levels. This plugin has not been onboarded yet, but once targeted for onboarding I would also like to see if there is a convenient way to fit this into that model as well by provisioning different levels of access to the context to different users but that may involve introducing new transport actions. Regardless, this change would work in both paradigms. |
| @@ -103,8 +103,10 @@ class AnomalyDetectionUtilsTests : OpenSearchTestCase() { | |||
| val searchSourceBuilder = SearchSourceBuilder() | |||
| addUserBackendRolesFilter( | |||
| User( | |||
| randomAlphaOfLength(5), null, listOf(randomAlphaOfLength(5)), | |||
| listOf(randomAlphaOfLength(5)) | |||
There was a problem hiding this comment.
I'm surprised this test did not need to be updated earlier. Has this repo been having failing tests?
Thanks for updating this!
| Assert.assertTrue(templateResults.isEmpty()) | ||
| } | ||
|
|
||
| fun `test results are excluded in document-level context even when allowed roles intersect monitor roles`() { |
There was a problem hiding this comment.
For my understanding, why is DocumentLevel context different from BucketLevel and QueryLevel?
There was a problem hiding this comment.
For whatever reason, the DocumentLevelTriggerExecutionContext is coded to never pass along results when instantiating the context:
You can see the third parameter there for the results is an emptyList(). So this context will never have results regardless of this new setting for controlling access that we're adding.
For the QueryLevelTriggerExecutionContext, you can see that the actual monitor results are passed along when instantiating the context:
This behavior is the same for the BucketLevelTriggerExecutionContext
There was a problem hiding this comment.
Looks like that's because the doc level monitor fires when a doc meets certain criteria, whereas bucket level monitor and query level trigger based on query results.
Is there any sensitive info that is present on doc level monitor that ought to be excluded?
There was a problem hiding this comment.
According to GPT-5.2 there is not:
You mostly get alert metadata and execution context, not query results or document contents.
I think it would have access to docId and index, but not _source
cwperks
left a comment
There was a problem hiding this comment.
@AWSHurneyt Could you also please review this? Thanks!
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…search-project#1939) * changed the maven url in build.gradle * url changed --------- (cherry picked from commit 8b6afc3) Signed-off-by: Riya Saxena <riysaxen@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…ch-project#1946) (opensearch-project#1947) (cherry picked from commit b87b2dd) Signed-off-by: Peter Zhu <zhujiaxi@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…rigger context Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…xts, not just the template arguments Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…in cluster settings to TriggerExecutionContext constructor Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…se when allowed roles are empty Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…tor user roles are included in allowed roles Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…gger contexts Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…context Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…ings Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…tting to distinguish between null for unset and an explicitly empty list Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…TS_ALLOWED_ROLES is not set Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…ON_CONTEXT_RESULTS_ALLOWED_ROLES is not set Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
…esults as a template argument instead of as a context property Signed-off-by: Mark Boyd <mark.boyd@gsa.gov>
9cd1067 to
7e7a84e
Compare
|
@AWSHurneyt Can we get another review on this? The CI checks are passing. |
Description
This PR includes a few changes:
NOTIFICATION_CONTEXT_RESULTS_ALLOWED_ROLESsetting to specify which user roles should have access to results from a trigger execution contexttemplateResultsproperty of theTriggerExecutionContextto conditionally maketemplateResultsempty ifNOTIFICATION_CONTEXT_RESULTS_ALLOWED_ROLESis set AND the allowed roles do not intersect with the monitor's user rolesasTemplateArg()method for trigger execution contexts to returntemplateResultsas the value for theresultsproperty in mustache templatestemplateResultsis correct for different scenariosRelated Issues
Resolves #1986
Check List
--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.