Skip to content

Commit

Permalink
Mute some security tests on problematic JDK8 build (#75770)
Browse files Browse the repository at this point in the history
This commit adds some `assumeFalse` (or modifies exising ones) to mute
tests on JDK 1.8.0_292 due to JDK-8266279

On this JDK build, a race condition sometimes causes the
PBEWithSHA1AndDESede algorithm to appear as though it is unavailable.

Relates: #75571, #75417, #75379, #72639, #72359
Backport of: #75718
  • Loading branch information
tvernum authored Jul 28, 2021
1 parent 84c3d03 commit aca2329
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@

import com.google.common.jimfs.Configuration;
import com.google.common.jimfs.Jimfs;
import org.bouncycastle.asn1.DLTaggedObject;
import org.elasticsearch.bootstrap.JavaVersion;
import org.elasticsearch.core.internal.io.IOUtils;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1String;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DLTaggedObject;
import org.bouncycastle.asn1.pkcs.Attribute;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
import org.bouncycastle.asn1.x509.Extension;
Expand All @@ -30,10 +28,13 @@
import org.elasticsearch.common.io.PathUtils;
import org.elasticsearch.common.network.NetworkAddress;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.internal.io.IOUtils;
import org.elasticsearch.env.Environment;
import org.elasticsearch.env.TestEnvironment;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.SecuritySettingsSourceField;
import org.elasticsearch.xpack.core.ssl.CertParsingUtils;
import org.elasticsearch.xpack.core.ssl.PemUtils;
import org.elasticsearch.xpack.security.cli.CertificateGenerateTool.CAInfo;
import org.elasticsearch.xpack.security.cli.CertificateGenerateTool.CertificateInformation;
import org.elasticsearch.xpack.security.cli.CertificateGenerateTool.Name;
Expand All @@ -43,8 +44,6 @@
import org.junit.After;
import org.junit.BeforeClass;

import javax.security.auth.x500.X500Principal;

import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
Expand Down Expand Up @@ -74,6 +73,7 @@
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.security.auth.x500.X500Principal;

import static org.elasticsearch.test.TestMatchers.pathExists;
import static org.hamcrest.Matchers.containsString;
Expand Down Expand Up @@ -265,7 +265,8 @@ public void testGeneratingCsr() throws Exception {

public void testGeneratingSignedCertificates() throws Exception {
assumeFalse("JDK bug JDK-8266279, https://github.com/elastic/elasticsearch/issues/72639",
JavaVersion.current().compareTo(JavaVersion.parse("8")) == 0);
"1.8.0_292".equals(System.getProperty("java.version")));

Path tempDir = initTempDir();
Path outputFile = tempDir.resolve("out.zip");
Path instanceFile = writeInstancesTo(tempDir.resolve("instances.yml"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.elasticsearch.xpack.security.authc.support.UserRoleMapper;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.BeforeClass;
import org.mockito.Mockito;
import org.opensaml.saml.common.xml.SAMLConstants;
import org.opensaml.saml.metadata.resolver.impl.AbstractReloadingMetadataResolver;
Expand Down Expand Up @@ -105,6 +106,12 @@ public void setupEnv() throws PrivilegedActionException {
threadContext = new ThreadContext(globalSettings);
}

@BeforeClass
public static void muteOnBrokenJdk() {
assumeFalse("JDK bug JDK-8266279, https://github.com/elastic/elasticsearch/issues/75571",
"1.8.0_292".equals(System.getProperty("java.version")));
}

public void testReadIdpMetadataFromFile() throws Exception {
final Path path = getDataPath("idp1.xml");
Tuple<RealmConfig, SSLService> config = buildConfig(path.toString());
Expand Down

0 comments on commit aca2329

Please sign in to comment.