Skip to content

Create replacement for java.security.Policy which is marked for removal#19631

Draft
cwperks wants to merge 7 commits intoopensearch-project:mainfrom
cwperks:upgrade-client-test-21
Draft

Create replacement for java.security.Policy which is marked for removal#19631
cwperks wants to merge 7 commits intoopensearch-project:mainfrom
cwperks:upgrade-client-test-21

Conversation

@cwperks
Copy link
Copy Markdown
Member

@cwperks cwperks commented Oct 14, 2025

Description

This PR ensure jdk 21 minimum compatibility across all sub-projects (a few projects had it set to Java 8) and create replacement for java.security.Policy which is marked for removal

Related Issues

Related to #18339

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

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.

…e repacement for java.security.Policy which is marked for removal

Signed-off-by: Craig Perkins <cwperx@amazon.com>
@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for fa5211c: 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>
@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for c0d489c: 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?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 9f25041: 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?

@github-actions
Copy link
Copy Markdown
Contributor

✅ Gradle check result for 9f25041: SUCCESS

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 15, 2025

Codecov Report

❌ Patch coverage is 3.26087% with 89 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.99%. Comparing base (4ab0ae9) to head (9f25041).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...n/java/org/opensearch/secure_sm/policy/Policy.java 0.00% 85 Missing ⚠️
...va/org/opensearch/gradle/OpenSearchJavaPlugin.java 0.00% 2 Missing ⚠️
...rg/opensearch/gradle/OpenSearchTestBasePlugin.java 0.00% 1 Missing ⚠️
...rg/opensearch/tools/cli/plugin/PluginSecurity.java 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19631      +/-   ##
============================================
+ Coverage     72.96%   72.99%   +0.02%     
+ Complexity    70655    70570      -85     
============================================
  Files          5725     5726       +1     
  Lines        323697   323764      +67     
  Branches      46875    46882       +7     
============================================
+ Hits         236198   236330     +132     
+ Misses        68436    68357      -79     
- Partials      19063    19077      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 973c04b: 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?

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Dec 1, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment on lines +153 to +166
// agent-sm libs - grant read access to avoid SecurityException with junit
for (URL url : JarHell.parseClassPath()) {
Path path = PathUtils.get(url.toURI());
if (path.toString().contains("agent-sm") && Files.isDirectory(path.getParent())) {
Path agentSmRoot = path;
while (agentSmRoot != null && !agentSmRoot.endsWith("agent-sm")) {
agentSmRoot = agentSmRoot.getParent();
}
if (agentSmRoot != null && Files.exists(agentSmRoot)) {
FilePermissionUtils.addDirectoryPath(perms, "agent-sm", agentSmRoot, "read,readlink", false);
break;
}
}
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixes SecurityException

java.lang.AssertionError: ERROR:An exception occurred processing Appender consoleSource:
DefaultErrorHandler.java@93
Throwable:
java.lang.SecurityException: Denied OPEN (read) access to file: /var/jenkins/workspace/gradle-check/search/libs/agent-sm/agent/build/distributions/opensearch-agent-policy-3.4.0-SNAPSHOT.jar, domain: ProtectionDomain  (file:/home/ubuntu/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-test-framework/10.3.1/dc0c9079bf5c7d660989bb37e822cd53e65ae103/lucene-test-framework-10.3.1.jar <no signer certificates>)
 jdk.internal.loader.ClassLoaders$AppClassLoader@73d16e93
 <no principals>
 java.security.Permissions@5ec6f378 (
)


	at java.base/java.nio.file.Files.newByteChannel(Files.java:393)
	at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:371)
	at java.base/java.nio.file.Files.newInputStream(Files.java:154)
	at java.base/jdk.internal.loader.BootLoader$PackageHelper.getManifest(BootLoader.java:301)
	at java.base/jdk.internal.loader.BootLoader$PackageHelper.definePackage(BootLoader.java:246)
	at java.base/jdk.internal.loader.BootLoader.getDefinedPackage(BootLoader.java:198)
	at java.base/jdk.internal.loader.BootLoader.definePackage(BootLoader.java:186)
	at java.base/java.lang.Class.getPackage(Class.java:1118)
	at org.apache.logging.log4j.core.impl.ThrowableProxyHelper.toCacheEntry(ThrowableProxyHelper.java:176)
	at org.apache.logging.log4j.core.impl.ThrowableProxyHelper.toExtendedStackTrace(ThrowableProxyHelper.java:112)
	at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:113)
	at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:97)
	at org.apache.logging.log4j.core.impl.MutableLogEvent.getThrownProxy(MutableLogEvent.java:354)
	at org.apache.logging.log4j.core.pattern.ExtendedThrowablePatternConverter.format(ExtendedThrowablePatternConverter.java:63)
	at org.apache.logging.log4j.core.pattern.PatternFormatter.format(PatternFormatter.java:44)
	at org.apache.logging.log4j.core.layout.PatternLayout$PatternFormatterPatternSerializer.toSerializable(PatternLayout.java:384)
	at org.apache.logging.log4j.core.layout.PatternLayout.toText(PatternLayout.java:240)
	at org.apache.logging.log4j.core.layout.PatternLayout.encode(PatternLayout.java:225)
	at org.apache.logging.log4j.core.layout.PatternLayout.encode(PatternLayout.java:59)

Received on tests like ./gradlew :plugins:discovery-gce:test --tests GceDiscoveryTests.testIllegalSettingsMissingZone -i

See https://build.ci.opensearch.org/job/gradle-check/67172/

Signed-off-by: Craig Perkins <cwperx@amazon.com>
@cwperks cwperks changed the title Ensure jdk 21 minimum compatibility across all sub-projects and create replacement for java.security.Policy which is marked for removal Create replacement for java.security.Policy which is marked for removal Dec 1, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 1, 2025

❌ Gradle check result for f5f358e: 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant