[POC] [Security Manager Replacement] Native Java Agent (dynamic code rewriting, must be low overhead)#16731
[POC] [Security Manager Replacement] Native Java Agent (dynamic code rewriting, must be low overhead)#16731reta wants to merge 1 commit intoopensearch-project:mainfrom
Conversation
|
❌ Gradle check result for 6b73ddf: 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? |
|
thanks @reta this is really interesting and such a quick progress. On a side note, it would be useful to add a small intro snippet how the |
Thanks @kumargu
Absolutely, I have updated the description (but will push it a bit once we get JDK-21 baseline with #16366, it would simplify a lot the APIs usage) |
9858717 to
ea045b0
Compare
libs/agent-sm/agent/build.gradle
Outdated
| "Can-Retransform-Classes": "true", | ||
| "Agent-Class": "org.opensearch.javaagent.Agent", | ||
| "Premain-Class": "org.opensearch.javaagent.Agent", | ||
| "Boot-Class-Path": 'byte-buddy-1.15.10.jar opensearch-agent-bootstrap-3.0.0-SNAPSHOT.jar' |
There was a problem hiding this comment.
opensearch-agent-bootstrap is shared between the OpenSearch service and the agent (so the Policy instance could be propagated)
|
❌ Gradle check result for ea045b0: 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? |
|
This PR is stalled because it has been open for 30 days with no activity. |
|
❌ Gradle check result for 58a227c: 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 5e20fde: 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 4688fd1: 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 930e6ef: 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? |
|
@reta is it feasible for the agent to coexist with SM enabled in 3.0, meaning both SM and Agent will enforce socket restrictions? |
I was thinking we could bring in replacements of JSM in 3.0 while JSM remains enabled in 3.0 (because we'd be still on JDK-21 in 3.0). Having the alternatives coexist for sometime will give us confidence and enough community feedback before we decide to remove it in some 3.x or 4.0. |
I think we would only target a most critical APIs by Java Agent (we just cannot much it to SM), however we should be able to run Java Agent on JDK-21 at least. |
100% agree. Maybe just the Socket interceptor for now since we see the problems with defining the port ranges in the PR #17107 |
|
❌ Gradle check result for c7e3022: 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? |
|
Sorry @kumargu , was late on that one, we have an issue with it https://github.com/opensearch-project/OpenSearch/pull/17753/files#r2031916820 |
ack. I'll raise a fix in a new PR tomorrow. |
|
Oh thanks. I will cancel mine #17820. |
|
❌ Gradle check result for 1ecaa7a: 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 c836a03: 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 689934e: 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? |
Hopefully these are not failing due to the new parser. Alternately should we try to simplify the FileInterceptor to not use |
Noo, see please #17852
Is there an issue with |
|
❕ Gradle check result for 8739577: 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. |
| if (task != null) { | ||
| if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_17) { | ||
| if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_17 && BuildParams.runtimeJavaVersion <= JavaVersion.VERSION_23) { | ||
| task.jvmArgs += ["-Djava.security.manager=allow"] |
There was a problem hiding this comment.
Is -Djava.security.manager=allow needed anymore now that the System.setSecurityManager calls have been removed?
There was a problem hiding this comment.
No, not anymore :-) I keep this pull request as POC to proof check any other work
There was a problem hiding this comment.
@andrross: @cwperks started taking a look at clean-ups of the -Djava.security.manager across all code bases in core. We think its not a lot of changes and we can do the clean-up (in a day or two) once the final PR from this POC is merged.
Thanks @kumargu, I should have the clean pull request to core tomorrow, doing some final tests with JDK-24
…ing, must be low overhead) Signed-off-by: Andriy Redko <andriy.redko@aiven.io> Signed-off-by: Andriy Redko <drreta@gmail.com>
|
❌ Gradle check result for ffaf1cd: 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 ffaf1cd: 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? |
|
Closing POC in favor of #17861 |
Description
Explore the the native Java Agent (dynamic code rewriting, must be low overhead).
How does it work:
bootstrapagentbootstrapmodule apply security policiesExample:
The sample
security.policy(stays the same as before):The application (OpenSearch) is run with the agent:
The application (OpenSearch) is applies security policy to the agent:
Running with
24-ea+31-3600:Related Issues
Closes #16633
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.