Skip to content

Commit

Permalink
Merge pull request #1496 from namtruong/java-17-compatibility
Browse files Browse the repository at this point in the history
Java 17 compatibility
  • Loading branch information
antonydenyer authored Nov 8, 2022
2 parents 05386b0 + a4ab0ed commit 0e9e3c6
Show file tree
Hide file tree
Showing 31 changed files with 462 additions and 204 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 14
java-version: 17
check-latest: true
- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 14
java-version: 17
check-latest: true
- name: Execute gradle dependencyCheckAnalyze task
run: ./gradlew dependencyCheckAnalyze -x test
Expand All @@ -84,7 +84,7 @@ jobs:
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 14
java-version: 17
check-latest: true
- name: Execute gradle test
run: ./gradlew test -x dependencyCheckAnalyze -x :tests:acceptance-test:test -x javadoc --info
Expand All @@ -100,7 +100,7 @@ jobs:
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 14
java-version: 17
check-latest: true
- name: Download tessera dist
uses: actions/download-artifact@v2
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 14
java-version: 17
check-latest: true
- name: Download tessera dist
uses: actions/download-artifact@v2
Expand Down Expand Up @@ -218,7 +218,7 @@ jobs:
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 14
java-version: 17
check-latest: true
- name: Download tessera dist
uses: actions/download-artifact@v2
Expand Down Expand Up @@ -276,7 +276,7 @@ jobs:
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 14
java-version: 17
check-latest: true
- name: Download tessera dist
uses: actions/download-artifact@v2
Expand Down Expand Up @@ -345,7 +345,7 @@ jobs:
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 14
java-version: 17
check-latest: true
- name: Download tessera dist
uses: actions/download-artifact@v2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The following artefacts can be [added to a distribution](#supplementing-the-dist

## Prerequisites
- [Java](https://www.oracle.com/technetwork/java/javase/downloads/index.html)
- Java 11+ (tested up to Java 14), code source is Java 11.
- Java 17+

- [Optional: Gradle](https://gradle.org/install/)<br/>
- If you want to use a locally installed Gradle rather than the included wrapper. Note: wrapper currently uses Gradle 7.0.2.
Expand Down
16 changes: 6 additions & 10 deletions argon2/src/main/java/com/quorum/tessera/argon2/Argon2Impl.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,11 @@ public ArgonResult hash(final char[] password, final byte[] salt) {
private Argon2Advanced getArgon2Instance(final String algorithm) {
LOGGER.debug("Searching for the Argon2 algorithm {}", algorithm);

switch (algorithm) {
case "d":
return Argon2Factory.createAdvanced(Argon2Factory.Argon2Types.ARGON2d);
case "id":
return Argon2Factory.createAdvanced(Argon2Factory.Argon2Types.ARGON2id);
case "i":
return Argon2Factory.createAdvanced(Argon2Factory.Argon2Types.ARGON2i);
default:
throw new IllegalArgumentException("Invalid Argon2 algorithm " + algorithm);
}
return switch (algorithm) {
case "d" -> Argon2Factory.createAdvanced(Argon2Factory.Argon2Types.ARGON2d);
case "id" -> Argon2Factory.createAdvanced(Argon2Factory.Argon2Types.ARGON2id);
case "i" -> Argon2Factory.createAdvanced(Argon2Factory.Argon2Types.ARGON2i);
default -> throw new IllegalArgumentException("Invalid Argon2 algorithm " + algorithm);
};
}
}
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import java.time.Duration
plugins {
id "org.owasp.dependencycheck" version "7.1.0.1"
id 'jacoco'
id 'com.diffplug.spotless' version '5.17.1'
id 'com.diffplug.spotless' version '6.11.0'
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
id "org.javamodularity.moduleplugin" version "1.8.8"
id 'org.ec4j.editorconfig' version '0.0.3'
Expand Down Expand Up @@ -57,7 +57,7 @@ allprojects {
testImplementation "junit:junit:4.13"

testImplementation "org.assertj:assertj-core:3.18.0"
testImplementation "org.mockito:mockito-inline:3.4.4"
testImplementation "org.mockito:mockito-inline:4.8.1"

testImplementation "com.github.jknack:handlebars:4.2.0"

Expand All @@ -76,7 +76,7 @@ allprojects {
implementation "org.apache.commons:commons-lang3:3.12.0"

implementation "com.github.jnr:jnr-unixsocket:0.38.15"
implementation "com.github.jnr:jffi:1.3.8"
implementation "com.github.jnr:jffi:1.3.9"

implementation "de.mkammerer:argon2-jvm:2.5"

Expand Down Expand Up @@ -256,7 +256,7 @@ subprojects {
}

jacoco {
toolVersion = "0.8.6"
toolVersion = "0.8.8"
}

spotless {
Expand All @@ -271,7 +271,7 @@ subprojects {
include "**/src/test/java/**/*.java"
}
removeUnusedImports()
googleJavaFormat("1.7")
googleJavaFormat("1.15.0")
trimTrailingWhitespace()
endWithNewline()
}
Expand Down Expand Up @@ -346,7 +346,7 @@ subprojects {
}
}

sourceCompatibility = "11"
sourceCompatibility = JavaVersion.VERSION_17

java {
withJavadocJar()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public void lockedKeyWithValidPasswordDoesNotRequestPassword() {

this.cliKeyPasswordResolver.getSingleKeyPassword(0, keyPair, keyEncryptor);

verifyZeroInteractions(passwordReader);
verifyNoInteractions(passwordReader);
}

// @Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public class ServerConfig extends ConfigItem {
@XmlElement
private Map<String, String> properties = Collections.emptyMap();

/** @deprecated USe default constructor and setters */
/**
* @deprecated USe default constructor and setters
*/
@Deprecated
public ServerConfig(
final AppType app,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;

import jakarta.validation.ConstraintValidatorContext;
import java.util.Base64;
Expand All @@ -24,7 +24,7 @@ public void onSetup() {

@After
public void onTearDown() {
verifyZeroInteractions(constraintValidatorContext);
verifyNoMoreInteractions(constraintValidatorContext);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void nullPathReturnsTrue() {

assertThat(pathValidator.isValid(null, context)).isTrue();

verifyZeroInteractions(context);
verifyNoInteractions(context);
}

@Test
Expand All @@ -96,7 +96,7 @@ public void checkCanCreateFile() throws IOException {

assertThat(pathValidator.isValid(path, context)).isTrue();

verifyZeroInteractions(context);
verifyNoInteractions(context);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;

import com.quorum.tessera.config.KeyDataConfig;
import com.quorum.tessera.config.PrivateKeyData;
Expand Down Expand Up @@ -105,6 +105,6 @@ public void noDelegateInclinePair() {
assertThat(filesystemKeyPair.getPrivateKeyPath()).isSameAs(privateKeyPath);
assertThat(filesystemKeyPair.getPublicKeyPath()).isSameAs(publicKeyPath);

verifyZeroInteractions(keyEncryptor);
verifyNoInteractions(keyEncryptor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void unlockedKeyGetsValue() {

assertThat(result.getPrivateKey()).isEqualTo(value);

verifyZeroInteractions(keyEncryptor);
verifyNoInteractions(keyEncryptor);
}

@Test
Expand All @@ -54,7 +54,7 @@ public void nullPasswordGivesNullKey() {
result.withPassword(null);

assertThat(result.getPrivateKey()).isNull();
verifyZeroInteractions(keyEncryptor);
verifyNoInteractions(keyEncryptor);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.verifyNoInteractions;

import com.quorum.tessera.config.KeyData;
import com.quorum.tessera.config.KeyDataConfig;
Expand Down Expand Up @@ -189,7 +189,7 @@ public void unmarshalDirectKeyPair() {
assertThat(result.getPublicKey()).isEqualTo("PUBLICKEY");
assertThat(result.getPrivateKey()).isEqualTo("PRIVATEKEY");

verifyZeroInteractions(keyEncryptor);
verifyNoInteractions(keyEncryptor);
}

@Test
Expand All @@ -208,7 +208,7 @@ public void unmarshalInlineKeypair() {
assertThat(result.getPublicKey()).isEqualTo("PUBLICKEY");
assertThat(result.getPrivateKeyConfig()).isSameAs(config);

verifyZeroInteractions(keyEncryptor);
verifyNoInteractions(keyEncryptor);
}

@Test
Expand All @@ -229,7 +229,7 @@ public void unmarshalAzureVaultKeyPair() {
assertThat(result.getPrivateKeyId()).isEqualTo("AzureVaultPrivateKeyId");
assertThat(result.getPublicKeyId()).isEqualTo("AzureVaultPublicKeyId");

verifyZeroInteractions(keyEncryptor);
verifyNoInteractions(keyEncryptor);
}

@Test
Expand All @@ -254,7 +254,7 @@ public void unmarshalHashicorpVaultKeyPair() {
assertThat(result.getSecretEngineName()).isEqualTo("HashicorpVaultSecretEngineName");
assertThat(result.getSecretName()).isEqualTo("HashicorpSecretName");

verifyZeroInteractions(keyEncryptor);
verifyNoInteractions(keyEncryptor);
}

@Test
Expand All @@ -278,7 +278,7 @@ public void unmarshalHashicorpVaultKeyPairNoSecretVersionDefined() {
assertThat(result.getSecretEngineName()).isEqualTo("HashicorpVaultSecretEngineName");
assertThat(result.getSecretName()).isEqualTo("HashicorpSecretName");

verifyZeroInteractions(keyEncryptor);
verifyNoInteractions(keyEncryptor);
}

@Test
Expand All @@ -296,7 +296,7 @@ public void unmarshalAwsVaultKeyPair() {
assertThat(result.getPrivateKeyId()).isEqualTo("AwsSecretsManagerPrivateKeyId");
assertThat(result.getPublicKeyId()).isEqualTo("AwsSecretsManagerPublicKeyId");

verifyZeroInteractions(keyEncryptor);
verifyNoInteractions(keyEncryptor);
}

@Test
Expand All @@ -317,7 +317,7 @@ public void unmarshalFilesystemKeyPair() {
assertThat(result.getPrivateKeyPath()).isSameAs(privateKeyPath);
assertThat(result.getPublicKeyPath()).isSameAs(publicKeyPath);

verifyZeroInteractions(keyEncryptor);
verifyNoInteractions(keyEncryptor);
}

@Test
Expand All @@ -330,7 +330,7 @@ public void unmarshalUnknownKeyPair() {

assertThat(result).isNotNull();

verifyZeroInteractions(keyEncryptor);
verifyNoInteractions(keyEncryptor);
}

@Test
Expand Down
8 changes: 8 additions & 0 deletions cvss-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,12 @@
<packageUrl regex="true">^pkg:maven/org.yaml/snakeyaml@1.33</packageUrl>
<cve>CVE-2022-38752</cve>
</suppress>
<suppress>
<notes><![CDATA[
file name: hsqldb-2.5.1.jar
Until 2.7.1 is released
]]></notes>
<packageUrl regex="true">^pkg:maven/org\.hsqldb/hsqldb@2.5.1</packageUrl>
<cve>CVE-2022-41853</cve>
</suppress>
</suppressions>
2 changes: 1 addition & 1 deletion docker/enclave.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN mkdir /install
RUN mkdir /install/enclave-jaxrs && tar xvf $(find . -name enclave-jaxrs-*.tar 2>/dev/null) -C /install/enclave-jaxrs --strip-components 1

# Create executable image
FROM eclipse-temurin:11-jre-jammy
FROM eclipse-temurin:17-jre-jammy

RUN apt-get update && apt-get install -y \
wget \
Expand Down
4 changes: 2 additions & 2 deletions docker/tessera.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN mkdir /install
RUN mkdir /install/tessera && tar xvf $(find . -name tessera-*.tar 2>/dev/null) -C /install/tessera --strip-components 1

# Create executable image
FROM eclipse-temurin:11-jre-jammy
FROM eclipse-temurin:17-jre-jammy

RUN apt-get update && apt-get install -y \
wget \
Expand All @@ -20,4 +20,4 @@ RUN apt-get update && apt-get install -y \

COPY --from=extractor /install/tessera/ /tessera

ENTRYPOINT ["/tessera/bin/tessera"]
ENTRYPOINT ["/tessera/bin/tessera"]
2 changes: 1 addition & 1 deletion docker/tessera.aws.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN mkdir /install/aws-key-vault && tar xvf $(find . -name aws-key-vault-*.tar 2
RUN mkdir /install/tessera-plus-vault && cp -a /install/aws-key-vault/. /install/tessera-plus-vault/ && cp -a /install/tessera/. /install/tessera-plus-vault/

# Create executable image
FROM eclipse-temurin:11-jre-jammy
FROM eclipse-temurin:17-jre-jammy

RUN apt-get update && apt-get install -y \
wget \
Expand Down
2 changes: 1 addition & 1 deletion docker/tessera.azure.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN mkdir /install/azure-key-vault && tar xvf $(find . -name azure-key-vault-*.t
RUN mkdir /install/tessera-plus-vault && cp -a /install/azure-key-vault/. /install/tessera-plus-vault/ && cp -a /install/tessera/. /install/tessera-plus-vault/

# Create executable image
FROM eclipse-temurin:11-jre-jammy
FROM eclipse-temurin:17-jre-jammy

RUN apt-get update && apt-get install -y \
wget \
Expand Down
2 changes: 1 addition & 1 deletion docker/tessera.hashicorp.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN mkdir /install/hashicorp-key-vault && tar xvf $(find . -name hashicorp-key-v
RUN mkdir /install/tessera-plus-vault && cp -a /install/hashicorp-key-vault/. /install/tessera-plus-vault/ && cp -a /install/tessera/. /install/tessera-plus-vault/

# Create executable image
FROM eclipse-temurin:11-jre-jammy
FROM eclipse-temurin:17-jre-jammy

RUN apt-get update && apt-get install -y \
wget \
Expand Down
Loading

0 comments on commit 0e9e3c6

Please sign in to comment.