Skip to content

Commit 19965d5

Browse files
authored
Removing unneeded check on SSLSession#getSessionContext (#120191)
1 parent 00bc91c commit 19965d5

File tree

4 files changed

+0
-29
lines changed

4 files changed

+0
-29
lines changed

libs/entitlement/bridge/src/main/java/org/elasticsearch/entitlement/bridge/EntitlementChecker.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import javax.net.ssl.HostnameVerifier;
3333
import javax.net.ssl.HttpsURLConnection;
3434
import javax.net.ssl.SSLContext;
35-
import javax.net.ssl.SSLSession;
3635
import javax.net.ssl.SSLSocketFactory;
3736

3837
@SuppressWarnings("unused") // Called from instrumentation code inserted by the Entitlements agent
@@ -193,9 +192,6 @@ public interface EntitlementChecker {
193192

194193
void check$java_net_URL$(Class<?> callerClass, URL context, String spec, URLStreamHandler handler);
195194

196-
// The only implementation of SSLSession#getSessionContext(); unfortunately it's an interface, so we need to check the implementation
197-
void check$sun_security_ssl_SSLSessionImpl$getSessionContext(Class<?> callerClass, SSLSession sslSession);
198-
199195
void check$java_net_DatagramSocket$bind(Class<?> callerClass, DatagramSocket that, SocketAddress addr);
200196

201197
void check$java_net_DatagramSocket$connect(Class<?> callerClass, DatagramSocket that, InetAddress addr);

libs/entitlement/qa/common/src/main/java/org/elasticsearch/entitlement/qa/common/RestEntitlementsCheckAction.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@
6060

6161
import javax.net.ssl.HttpsURLConnection;
6262
import javax.net.ssl.SSLContext;
63-
import javax.net.ssl.SSLSession;
64-
import javax.net.ssl.SSLSocket;
65-
import javax.net.ssl.SSLSocketFactory;
6663

6764
import static java.util.Map.entry;
6865
import static org.elasticsearch.entitlement.qa.common.RestEntitlementsCheckAction.CheckAction.alwaysDenied;
@@ -147,7 +144,6 @@ static CheckAction alwaysDenied(CheckedRunnable<Exception> action) {
147144
entry("createURLStreamHandlerProvider", alwaysDenied(RestEntitlementsCheckAction::createURLStreamHandlerProvider)),
148145
entry("createURLWithURLStreamHandler", alwaysDenied(RestEntitlementsCheckAction::createURLWithURLStreamHandler)),
149146
entry("createURLWithURLStreamHandler2", alwaysDenied(RestEntitlementsCheckAction::createURLWithURLStreamHandler2)),
150-
entry("sslSessionImpl_getSessionContext", alwaysDenied(RestEntitlementsCheckAction::sslSessionImplGetSessionContext)),
151147
entry("datagram_socket_bind", forPlugins(RestEntitlementsCheckAction::bindDatagramSocket)),
152148
entry("datagram_socket_connect", forPlugins(RestEntitlementsCheckAction::connectDatagramSocket)),
153149
entry("datagram_socket_send", forPlugins(RestEntitlementsCheckAction::sendDatagramSocket)),
@@ -165,15 +161,6 @@ public URLStreamHandler createURLStreamHandler(String protocol) {
165161
};
166162
}
167163

168-
private static void sslSessionImplGetSessionContext() throws IOException {
169-
SSLSocketFactory factory = HttpsURLConnection.getDefaultSSLSocketFactory();
170-
try (SSLSocket socket = (SSLSocket) factory.createSocket()) {
171-
SSLSession session = socket.getSession();
172-
173-
session.getSessionContext();
174-
}
175-
}
176-
177164
@SuppressWarnings("deprecation")
178165
private static void createURLWithURLStreamHandler() throws MalformedURLException {
179166
var x = new URL("http", "host", 1234, "file", new URLStreamHandler() {

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/api/ElasticsearchEntitlementChecker.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import javax.net.ssl.HostnameVerifier;
3737
import javax.net.ssl.HttpsURLConnection;
3838
import javax.net.ssl.SSLContext;
39-
import javax.net.ssl.SSLSession;
4039
import javax.net.ssl.SSLSocketFactory;
4140

4241
/**
@@ -352,11 +351,6 @@ public ElasticsearchEntitlementChecker(PolicyManager policyManager) {
352351
policyManager.checkChangeNetworkHandling(callerClass);
353352
}
354353

355-
@Override
356-
public void check$sun_security_ssl_SSLSessionImpl$getSessionContext(Class<?> callerClass, SSLSession sslSession) {
357-
policyManager.checkReadSensitiveNetworkInformation(callerClass);
358-
}
359-
360354
@Override
361355
public void check$java_net_DatagramSocket$bind(Class<?> callerClass, DatagramSocket that, SocketAddress addr) {
362356
policyManager.checkNetworkAccess(callerClass, NetworkEntitlement.LISTEN_ACTION);

muted-tests.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,6 @@ tests:
235235
- class: org.elasticsearch.index.mapper.IntervalThrottlerTests
236236
method: testThrottling
237237
issue: https://github.com/elastic/elasticsearch/issues/120023
238-
- class: org.elasticsearch.entitlement.qa.EntitlementsDeniedIT
239-
method: testCheckThrows {pathPrefix=denied actionName=sslSessionImpl_getSessionContext}
240-
issue: https://github.com/elastic/elasticsearch/issues/120053
241-
- class: org.elasticsearch.entitlement.qa.EntitlementsDeniedIT
242-
method: testCheckThrows {pathPrefix=denied_nonmodular actionName=sslSessionImpl_getSessionContext}
243-
issue: https://github.com/elastic/elasticsearch/issues/120054
244238
- class: org.elasticsearch.xpack.ilm.actions.SearchableSnapshotActionIT
245239
method: testUpdatePolicyToAddPhasesYieldsInvalidActionsToBeSkipped
246240
issue: https://github.com/elastic/elasticsearch/issues/118406

0 commit comments

Comments
 (0)