generated from amazon-archives/__template_Custom
-
Notifications
You must be signed in to change notification settings - Fork 181
Fix issue connecting with prometheus by wrapping with AccessController.doPrivilegedChecked #5061
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
Merged
+15
−14
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: opensearch-project/sql
Length of output: 1543
🏁 Script executed:
Repository: opensearch-project/sql
Length of output: 1308
🏁 Script executed:
Repository: opensearch-project/sql
Length of output: 109
🏁 Script executed:
Repository: opensearch-project/sql
Length of output: 7759
🏁 Script executed:
Repository: opensearch-project/sql
Length of output: 9152
🏁 Script executed:
Repository: opensearch-project/sql
Length of output: 993
Inconsistent application of the security fix across HTTP call sites.
The
AccessController.doPrivilegedCheckedwrapper is applied only togetAllMetrics(line 179), but 13 other methods in this class make HTTP calls using the same pattern (prometheusHttpClient.newCall(request).execute()oralertmanagerHttpClient.newCall(request).execute()). If the SecurityException is triggered by socket connections ingetAllMetrics, it will likely occur in other methods making identical HTTP calls:queryRange(line 95)query(line 130)getLabels(line 150)getLabel(line 165)getSeries(line 198)queryExemplars(line 215)getAlerts(line 226)getRules(line 239)getAlertmanagerAlerts(line 252)getAlertmanagerAlertGroups(line 265)getAlertmanagerReceivers(line 277)getAlertmanagerSilences(line 289)createAlertmanagerSilences(line 305)Extract a helper method to centralize the privileged execution and apply it consistently:
Suggested approach
Then use it consistently across all HTTP call sites:
🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the change. The change itself looks good to me, however, I'm also curious the following:
cc @cwperks @joshuali925 @lezzago
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the components in the above list are also for prometheus. I just included them in this PR
I don't know why only Prometheus got impacted, or if any other components got impacted
This issue does not occur with core + sql, it needs some other plugins that intercepts and filters requests to trigger. We found it when testing the distribution with all plugins installed