Skip to content
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

CALCITE-6590 Remove use of Java SecurityManager in Avatica #250

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ allprojects {
options.encoding = "UTF-8"
}
withType<Test>().configureEach {
if (JavaVersion.current() >= JavaVersion.VERSION_23) {
jvmArgs("-Djava.security.manager=allow")
}
testLogging {
exceptionFormat = TestExceptionFormat.FULL
showStandardStreams = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ public DoAsAvaticaHttpClient(AvaticaHttpClient wrapped, KerberosConnection kerbe
this.kerberosUtil = Objects.requireNonNull(kerberosUtil);
}

@Override public byte[] send(final byte[] request) {
// Subject.doAs is deprecated and does not work in JDK23+ unless the (also deprecated)
// SecurityManager is enabled. However, the replacement API is not available in JDK8,
// so as a workaround we require enabling the securityManager on JDK23+.
// Also see https://issues.apache.org/jira/browse/CALCITE-6590 and https://openjdk.org/jeps/411
// This class is used with Hadoop, which has the same issue.
@Override @SuppressWarnings("removal")
public byte[] send(final byte[] request) {
return Subject.doAs(kerberosUtil.getSubject(), new PrivilegedAction<byte[]>() {
@Override public byte[] run() {
return wrapped.send(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ public static void writeSpnegoConf(File configFile, File serverKeytab)
}
}

// Subject.doAs is deprecated and does not work in JDK23+ unless the (also deprecated)
// SecurityManager is enabled. However, the replacement API is not available in JDK8,
// so as a workaround we require enabling the securityManager on JDK23+.
// Also see https://issues.apache.org/jira/browse/CALCITE-6590 and https://openjdk.org/jeps/411
// We add the "-Djava.security.manager=allow" cli option for tests when running with JDK23+
// so that this keeps working.
@SuppressWarnings("removal")
public static void refreshJaasConfiguration() {
// This is *extremely* important to make sure we get the right Configuration instance.
// Configuration keeps a static instance of Configuration that it will return once it
Expand Down
Loading