-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Create equivalents of JSM's AccessController in the java agent #18346
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
Conversation
…oller Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.javaagent.bootstrap; |
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.
I don't know the right module for this code. The server has a dependency on this lib, but its marked as compileOnly
. How are the other classes in this module (like AgentPolicy) available at runtime?
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.
I believe jars passed to the JVM via -javaagent
are available on the classpath, so the compileOnly dependency is making the assumption this will be provided at runtime via a -javaagent
.
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #18346 +/- ##
============================================
- Coverage 72.81% 72.62% -0.19%
+ Complexity 68209 68113 -96
============================================
Files 5541 5542 +1
Lines 313390 313396 +6
Branches 45472 45472
============================================
- Hits 228196 227608 -588
- Misses 66671 67247 +576
- Partials 18523 18541 +18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
libs/agent-sm/bootstrap/src/main/java/org/opensearch/javaagent/bootstrap/AccessController.java
Outdated
Show resolved
Hide resolved
libs/agent-sm/bootstrap/src/main/java/org/opensearch/javaagent/bootstrap/AccessController.java
Outdated
Show resolved
Hide resolved
libs/agent-sm/bootstrap/src/main/java/org/opensearch/javaagent/bootstrap/AccessController.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Craig Perkins <cwperx@amazon.com>
❕ Gradle check result for 53be672: UNSTABLE Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure. |
libs/agent-sm/bootstrap/src/main/java/org/opensearch/javaagent/bootstrap/AccessController.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
❌ Gradle check result for 00c22c7: null Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
❌ Gradle check result for d79bdc1: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
modules/ingest-geoip/src/main/java/org/opensearch/ingest/geoip/GeoIpProcessor.java
Outdated
Show resolved
Hide resolved
❌ Gradle check result for 9cfa314: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
@andrross All comments have been addressed. Can you re-review this PR? |
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
This is going to need changing the |
@kumargu We'll continue to support both the JDK-based access controller and the new version as long as the JDK still contains those classes. Plugins should have a long time to make the update (likely the entire 3.x series at least). |
Gotcha. makes sense. |
.../agent/src/main/java/org/opensearch/javaagent/StackCallerProtectionDomainChainExtractor.java
Show resolved
Hide resolved
libs/agent-sm/agent-policy/src/main/java/org/opensearch/security/AccessController.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Craig Perkins <cwperx@amazon.com>
libs/agent-sm/agent-policy/src/main/java/org/opensearch/security/package-info.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Craig Perkins <cwperx@amazon.com>
❌ Gradle check result for c6a61fc: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
❌ Gradle check result for 5c32ba2: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
❕ Gradle check result for 5c32ba2: UNSTABLE Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure. |
Signed-off-by: Craig Perkins <cwperx@amazon.com>
…earch-project#18346) * Create OpenSearch replacements for widely used methods in AccessController Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix javadoc Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove getException Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove other instance of apiNote Signed-off-by: Craig Perkins <cwperx@amazon.com> * Modify javadoc and restart stuck CI checks Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove mistakenly added line Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add to CHANGELOG Signed-off-by: Craig Perkins <cwperx@amazon.com> * Address code review feedback Signed-off-by: Craig Perkins <cwperx@amazon.com> * Use callable and runnable Signed-off-by: Craig Perkins <cwperx@amazon.com> * Use Callable Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add checked equivalents to interface Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add throws IllegalArgumentException Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix precommit Signed-off-by: Craig Perkins <cwperx@amazon.com> * Show example of replacement in a module Signed-off-by: Craig Perkins <cwperx@amazon.com> * Address code review comments Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix precommit Signed-off-by: Craig Perkins <cwperx@amazon.com> * Address code review comments Signed-off-by: Craig Perkins <cwperx@amazon.com> * Create separate agent-api lib and remove compileOnlyApi Signed-off-by: Craig Perkins <cwperx@amazon.com> * Re-use agent-policy lib Signed-off-by: Craig Perkins <cwperx@amazon.com> * Address review comments Signed-off-by: Craig Perkins <cwperx@amazon.com> * Move to secure_sm package Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix conflicts in CHANGELOG Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com>Signed-off-by: TJ Neuenfeldt <tjneu@amazon.com>
…earch-project#18346) * Create OpenSearch replacements for widely used methods in AccessController Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix javadoc Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove getException Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove other instance of apiNote Signed-off-by: Craig Perkins <cwperx@amazon.com> * Modify javadoc and restart stuck CI checks Signed-off-by: Craig Perkins <cwperx@amazon.com> * Remove mistakenly added line Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add to CHANGELOG Signed-off-by: Craig Perkins <cwperx@amazon.com> * Address code review feedback Signed-off-by: Craig Perkins <cwperx@amazon.com> * Use callable and runnable Signed-off-by: Craig Perkins <cwperx@amazon.com> * Use Callable Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add checked equivalents to interface Signed-off-by: Craig Perkins <cwperx@amazon.com> * Add throws IllegalArgumentException Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix precommit Signed-off-by: Craig Perkins <cwperx@amazon.com> * Show example of replacement in a module Signed-off-by: Craig Perkins <cwperx@amazon.com> * Address code review comments Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix precommit Signed-off-by: Craig Perkins <cwperx@amazon.com> * Address code review comments Signed-off-by: Craig Perkins <cwperx@amazon.com> * Create separate agent-api lib and remove compileOnlyApi Signed-off-by: Craig Perkins <cwperx@amazon.com> * Re-use agent-policy lib Signed-off-by: Craig Perkins <cwperx@amazon.com> * Address review comments Signed-off-by: Craig Perkins <cwperx@amazon.com> * Move to secure_sm package Signed-off-by: Craig Perkins <cwperx@amazon.com> * Fix conflicts in CHANGELOG Signed-off-by: Craig Perkins <cwperx@amazon.com> --------- Signed-off-by: Craig Perkins <cwperx@amazon.com>
Description
The classes in this PR were on a former iteration of #17894
This PR creates replacements for JSM's AccessController which is marked for removal from the JDK. While JSM was replaced with the java agent in 3.0.0, the logic to extract the ProtectionDomains from the call stack relies on the AccessController to limit the frames when examining the stack. The java agent needs to retain this code marker to know when to stop walking the stack and this PR creates OpenSearch equivalents to the AccessController which is a simple wrapper around a runnable block of code.
Related Issues
Resolves #18339
Check List
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.