Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
for (int i = 0; i < args.length; i++) {
argsEncoded[i] = Utils.urlEncodeUtf8(String.valueOf(args[i]));
}
return String.format(fmt, argsEncoded);

Check warning on line 205 in storm-webapp/src/main/java/org/apache/storm/daemon/ui/UIHelpers.java

View workflow job for this annotation

GitHub Actions / test (25, Server, false)

non-varargs call of varargs method with inexact argument type for last parameter;
}

/**
Expand Down Expand Up @@ -232,8 +232,9 @@
Boolean needClientAuth, Boolean wantClientAuth,
Integer headerBufferSize, boolean enableSslReload) {
SslContextFactory.Server factory = new ReloadableSslContextFactory(enableSslReload);
factory.setExcludeCipherSuites("SSL_RSA_WITH_RC4_128_MD5", "SSL_RSA_WITH_RC4_128_SHA");
factory.setExcludeProtocols("SSLv3");
// add to, rather than replace, the exclusions Jetty's SslContextFactory ships with
factory.addExcludeCipherSuites("SSL_RSA_WITH_RC4_128_MD5", "SSL_RSA_WITH_RC4_128_SHA");
factory.addExcludeProtocols("SSLv3");
factory.setRenegotiationAllowed(false);
factory.setKeyStorePath(ksPath);
factory.setKeyStoreType(ksType);
Expand Down Expand Up @@ -314,8 +315,8 @@
* @return corsFilterHandle
*/
public static FilterHolder corsFilterHandle() {
FilterHolder filterHolder = new FilterHolder(new CrossOriginFilter());

Check warning on line 318 in storm-webapp/src/main/java/org/apache/storm/daemon/ui/UIHelpers.java

View workflow job for this annotation

GitHub Actions / test (25, Server, false)

org.eclipse.jetty.ee10.servlets.CrossOriginFilter in org.eclipse.jetty.ee10.servlets has been deprecated and marked for removal
filterHolder.setInitParameter(CrossOriginFilter.ALLOWED_ORIGINS_PARAM, "*");

Check warning on line 319 in storm-webapp/src/main/java/org/apache/storm/daemon/ui/UIHelpers.java

View workflow job for this annotation

GitHub Actions / test (25, Server, false)

org.eclipse.jetty.ee10.servlets.CrossOriginFilter in org.eclipse.jetty.ee10.servlets has been deprecated and marked for removal
filterHolder.setInitParameter(CrossOriginFilter.ALLOWED_METHODS_PARAM, "GET, POST, PUT");
filterHolder.setInitParameter(
CrossOriginFilter.ALLOWED_HEADERS_PARAM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,23 @@
import org.apache.storm.generated.TopologyStats;
import org.apache.storm.utils.Time;
import net.minidev.json.JSONValue;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
Expand Down Expand Up @@ -665,4 +675,26 @@ public void testGetJsonResponseHeadersInvalidCallbackFallsBackToJsonContentType(
assertEquals("application/json;charset=utf-8", headers.get("Content-Type"));
assertEquals("nosniff", headers.get("X-Content-Type-Options"));
}
}

@Test
public void testConfigSslKeepsJettyDefaultTlsExclusions(@TempDir Path tempDir) throws Exception {
SslContextFactory.Server defaults = new SslContextFactory.Server();
Set<String> expectedProtocols = new LinkedHashSet<>(Arrays.asList(defaults.getExcludeProtocols()));
Set<String> expectedCiphers = new LinkedHashSet<>(Arrays.asList(defaults.getExcludeCipherSuites()));
assertFalse(expectedProtocols.isEmpty());
assertFalse(expectedCiphers.isEmpty());
expectedProtocols.add("SSLv3");
expectedCiphers.add("SSL_RSA_WITH_RC4_128_MD5");
expectedCiphers.add("SSL_RSA_WITH_RC4_128_SHA");

Path keyStore = Files.createFile(tempDir.resolve("keystore.jks"));
Server server = new Server();
UIHelpers.configSsl(server, 8443, keyStore.toString(), "password", "JKS", "password",
null, null, null, false, false, false);

ServerConnector connector = (ServerConnector) server.getConnectors()[0];
SslContextFactory factory = connector.getConnectionFactory(SslConnectionFactory.class).getSslContextFactory();
assertEquals(expectedProtocols, new LinkedHashSet<>(Arrays.asList(factory.getExcludeProtocols())));
assertEquals(expectedCiphers, new LinkedHashSet<>(Arrays.asList(factory.getExcludeCipherSuites())));
}
}
Loading