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

Merge develop to master #417

Merged
merged 38 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9f485ad
Bump spring-boot.version from 3.1.6 to 3.2.1
dependabot[bot] Jan 2, 2024
0a639db
Revert "Fix #388: Update logback"
banterCZ Jan 2, 2024
656489b
Fix #404: Set develop version to 1.7.0-SNAPSHOT
banterCZ Jan 8, 2024
b031c7d
Fix #405: Update Wultra dependencies to SNAPSHOT
banterCZ Jan 8, 2024
57f11a5
Merge pull request #407 from wultra/issues/404-version-1.7.0-SNAPSHOT
banterCZ Jan 8, 2024
6fb9c17
Merge pull request #400 from wultra/dependabot/maven/spring-boot.vers…
dependabot[bot] Jan 8, 2024
61eda57
Merge pull request #408 from wultra/issues/405-wultra-snapshots
banterCZ Jan 8, 2024
ebca262
Fix #401: Remove Guava dependency
banterCZ Jan 4, 2024
ff78085
Merge pull request #402 from wultra/issues/401-remove-guava
banterCZ Jan 12, 2024
6195502
Bump org.apache.maven.plugins:maven-surefire-plugin from 3.2.3 to 3.2.5
dependabot[bot] Jan 15, 2024
1c52b65
Merge pull request #409 from wultra/dependabot/maven/org.apache.maven…
dependabot[bot] Jan 16, 2024
29d6ec3
Bump spring-boot.version from 3.2.1 to 3.2.2
dependabot[bot] Jan 22, 2024
82c917b
Merge pull request #410 from wultra/dependabot/maven/spring-boot.vers…
dependabot[bot] Jan 23, 2024
6ddd3de
Fix #411: Logging of steps create invalid JSON
petrdvorak Jan 29, 2024
7d0f888
Fix #413: Make custom attributes file optional during activation crea…
petrdvorak Jan 29, 2024
d050581
Merge pull request #414 from wultra/issues/413-custom-attributes-opti…
petrdvorak Jan 29, 2024
0bf8c1c
Fix #415: Reflect changes of ConfirmRecoveryResponsePayload
banterCZ Feb 8, 2024
109870a
Merge pull request #416 from wultra/issues/415-ConfirmRecoveryRespons…
banterCZ Feb 8, 2024
0ce7714
Merge pull request #412 from wultra/issues/411-logger
banterCZ Feb 21, 2024
2bbad27
Fix #418: Set release version to 1.7.0
banterCZ Feb 22, 2024
071a6b9
Bump spring-boot.version from 3.2.2 to 3.2.3
dependabot[bot] Feb 23, 2024
e58ecee
Merge pull request #423 from wultra/dependabot/maven/spring-boot.vers…
dependabot[bot] Feb 23, 2024
1a944b2
Fix #424: Coverity: Dereference null return value (#425)
banterCZ Feb 26, 2024
ff322b6
Update GitHub Actions to JDK 21
banterCZ Mar 7, 2024
868b6c5
Merge pull request #428 from wultra/issues/gha-jdk-21
banterCZ Mar 7, 2024
f724d59
Bump spring-boot.version from 3.2.3 to 3.2.4
dependabot[bot] Mar 25, 2024
6ee0437
Bump org.apache.maven.plugins:maven-compiler-plugin
dependabot[bot] Mar 25, 2024
3cfb139
Merge pull request #429 from wultra/dependabot/maven/spring-boot.vers…
dependabot[bot] Mar 26, 2024
107672e
Merge pull request #430 from wultra/dependabot/maven/org.apache.maven…
dependabot[bot] Mar 26, 2024
737a7e7
Downgrade JDK for Coverity GHA to 17
banterCZ Mar 28, 2024
3add840
Merge pull request #431 from wultra/issues/gha-coverity-jdk-17
banterCZ Mar 28, 2024
17ad4cc
Bump org.apache.maven.plugins:maven-source-plugin from 3.3.0 to 3.3.1
dependabot[bot] Apr 8, 2024
718c779
Bump commons-io:commons-io from 2.15.1 to 2.16.1
dependabot[bot] Apr 8, 2024
19f0c50
Merge pull request #435 from wultra/dependabot/maven/org.apache.maven…
dependabot[bot] Apr 9, 2024
be3709e
Merge pull request #438 from wultra/dependabot/maven/commons-io-commo…
dependabot[bot] Apr 9, 2024
16a9a8a
Fix #420: Update Wultra dependencies
banterCZ Feb 22, 2024
8a3c950
Merge pull request #421 from wultra/issues/420-wultra-dependencies
banterCZ Apr 9, 2024
e8491ed
Merge pull request #422 from wultra/issues/418-version-1.7.0
banterCZ Apr 9, 2024
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: 2 additions & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ jobs:
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
java_version: 21
2 changes: 2 additions & 0 deletions .github/workflows/maven-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
with:
environment: internal-publish
release_type: snapshot
java_version: 21
secrets:
username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
Expand All @@ -45,6 +46,7 @@ jobs:
with:
environment: ${{ inputs.environment }}
release_type: ${{ inputs.release_type }}
java_version: 21
secrets:
username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/maven-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ on:
jobs:
maven-tests:
uses: wultra/wultra-infrastructure/.github/workflows/maven-test.yml@develop
secrets: inherit
secrets: inherit
with:
java_version: 21
51 changes: 15 additions & 36 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<groupId>io.getlime.security</groupId>
<artifactId>powerauth-cmd-parent</artifactId>
<version>1.6.0</version>
<version>1.7.0</version>
<packaging>pom</packaging>

<inceptionYear>2016</inceptionYear>
Expand Down Expand Up @@ -76,24 +76,22 @@
<java.version>17</java.version>
<maven.compiler.release>${java.version}</maven.compiler.release>

<maven-compiler-plugin.version>3.12.1</maven-compiler-plugin.version>
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
<maven-enforcer-plugin.version>3.4.1</maven-enforcer-plugin.version>
<maven-surefire-plugin.version>3.2.3</maven-surefire-plugin.version>
<spring-boot.version>3.1.6</spring-boot.version>
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
<spring-boot.version>3.2.4</spring-boot.version>
<bc.version>1.77</bc.version>
<commons-cli.version>1.6.0</commons-cli.version>
<commons-io.version>2.15.1</commons-io.version>
<commons-io.version>2.16.1</commons-io.version>
<json-simple.version>1.1.1</json-simple.version>
<!-- TODO (racansky, 2023-12-08) temporarily override the version 1.4.11 from spring boot version because of CVE -->
<logback.version>1.4.14</logback.version>

<!-- Wultra Dependencies -->
<powerauth-restful-integration>1.6.0</powerauth-restful-integration>
<powerauth-crypto.version>1.6.0</powerauth-crypto.version>
<wultra-core.version>1.8.0</wultra-core.version>
<powerauth-restful-integration>1.7.0</powerauth-restful-integration>
<powerauth-crypto.version>1.7.0</powerauth-crypto.version>
<wultra-core.version>1.9.0</wultra-core.version>
</properties>

<dependencyManagement>
Expand All @@ -106,18 +104,6 @@
<scope>import</scope>
</dependency>

<!-- TODO (racansky, 2023-12-08) temporarily override the version 1.4.11 from spring boot version because of CVE -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>

<dependency>
<groupId>io.getlime.security</groupId>
<artifactId>powerauth-java-cmd-lib</artifactId>
Expand Down Expand Up @@ -191,26 +177,19 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${maven-enforcer-plugin.version}</version>
<dependencies>
<dependency>
<groupId>de.skuzzle.enforcer</groupId>
<artifactId>restrict-imports-enforcer-rule</artifactId>
<version>2.4.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>enforce-banned-java-imports</id>
<id>enforce-banned-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<RestrictImports>
<!-- https://github.com/google/guava/issues/2960 -->
<reason>Guava depends on jsr305 but we prefer jakarta in our code</reason>
<bannedImport>javax.annotation.**</bannedImport>
</RestrictImports>
<bannedDependencies>
<excludes>
<exclude>com.google.guava:guava*:*:*:compile</exclude>
</excludes>
</bannedDependencies>
</rules>
</configuration>
</execution>
Expand Down
2 changes: 1 addition & 1 deletion powerauth-java-cmd-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<artifactId>powerauth-cmd-parent</artifactId>
<groupId>io.getlime.security</groupId>
<version>1.6.0</version>
<version>1.7.0</version>
</parent>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
*/
package io.getlime.security.powerauth.lib.cmd.consts;

import com.google.common.collect.ImmutableList;

import java.util.Arrays;
import java.util.List;

/**
* PowerAuth protocol version enumeration
Expand All @@ -45,7 +44,7 @@ public enum PowerAuthVersion {
/**
* All supported versions
*/
public static final ImmutableList<PowerAuthVersion> ALL_VERSIONS = ImmutableList.copyOf(values());
public static final List<PowerAuthVersion> ALL_VERSIONS = List.of(values());

/**
* Default version
Expand All @@ -55,7 +54,7 @@ public enum PowerAuthVersion {
/**
* All versions belonging to major version 3
*/
public static final ImmutableList<PowerAuthVersion> VERSION_3 = ImmutableList.of(V3_0, V3_1, V3_2);
public static final List<PowerAuthVersion> VERSION_3 = List.of(V3_0, V3_1, V3_2);

/**
* Major version value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ public ResultStatusObject execute(PowerAuthStep stepId, PowerAuthVersion version
throw new PowerAuthCmdException();
}

BaseStep step = stepProvider.getStep(stepId, version);
final BaseStep step = stepProvider.getStep(stepId, version);

ResultStatusObject result = step.execute(model.toMap());
final ResultStatusObject result = step.execute(stepLogger, model.toMap());
if (result == null) {
throw new PowerAuthCmdException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package io.getlime.security.powerauth.lib.cmd.steps;

import com.google.common.collect.ImmutableList;
import com.wultra.core.rest.client.base.RestClient;
import com.wultra.core.rest.client.base.RestClientException;
import io.getlime.security.powerauth.crypto.lib.encryptor.ClientEncryptor;
Expand All @@ -27,8 +26,6 @@
import io.getlime.security.powerauth.crypto.lib.encryptor.model.EncryptorId;
import io.getlime.security.powerauth.crypto.lib.encryptor.model.EncryptorParameters;
import io.getlime.security.powerauth.crypto.lib.encryptor.model.v3.ClientEncryptorSecrets;
import io.getlime.security.powerauth.crypto.lib.generator.KeyGenerator;
import io.getlime.security.powerauth.crypto.lib.util.KeyConvertor;
import io.getlime.security.powerauth.lib.cmd.consts.PowerAuthStep;
import io.getlime.security.powerauth.lib.cmd.consts.PowerAuthVersion;
import io.getlime.security.powerauth.lib.cmd.logging.DisabledStepLogger;
Expand Down Expand Up @@ -80,7 +77,7 @@ public abstract class AbstractBaseStep<M extends BaseStepData, R> implements Bas
* Supported versions of PowerAuth by this step
*/
@Getter
private final ImmutableList<PowerAuthVersion> supportedVersions;
private final List<PowerAuthVersion> supportedVersions;

/**
* Result status service
Expand All @@ -93,8 +90,6 @@ public abstract class AbstractBaseStep<M extends BaseStepData, R> implements Bas
protected final StepLoggerFactory stepLoggerFactory;

private static final EncryptorFactory ENCRYPTOR_FACTORY = new EncryptorFactory();
private static final KeyGenerator KEY_GENERATOR = new KeyGenerator();
private static final KeyConvertor KEY_CONVERTOR = new KeyConvertor();

/**
* Constructor
Expand All @@ -109,7 +104,7 @@ public AbstractBaseStep(PowerAuthStep step,
ResultStatusService resultStatusService,
StepLoggerFactory stepLoggerFactory) {
this.step = step;
this.supportedVersions = ImmutableList.copyOf(supportedVersions);
this.supportedVersions = List.copyOf(supportedVersions);

this.resultStatusService = resultStatusService;
this.stepLoggerFactory = stepLoggerFactory;
Expand All @@ -130,26 +125,6 @@ public AbstractBaseStep(PowerAuthStep step,
*/
protected abstract ParameterizedTypeReference<R> getResponseTypeReference();

/**
* Executes this step with a given context
*
* @param context Provided context
* @return Result status object, null in case of failure.
* @throws Exception In case of any error.
*/
@Override
public ResultStatusObject execute(Map<String, Object> context) throws Exception {
StepLogger stepLogger = stepLoggerFactory.createStepLogger();
stepLogger.start();
JSONObject jsonObject = execute(stepLogger, context);
stepLogger.close();
if (jsonObject == null) {
return null;
} else {
return ResultStatusObject.fromJsonObject(jsonObject);
}
}

/**
* Execute this step with given logger and context objects.
*
Expand All @@ -160,7 +135,7 @@ public ResultStatusObject execute(Map<String, Object> context) throws Exception
* @return Result status object (with current activation status), null in case of failure.
* @throws Exception In case of a failure.
*/
public final JSONObject execute(StepLogger stepLogger, Map<String, Object> context) throws Exception {
public final ResultStatusObject execute(StepLogger stepLogger, Map<String, Object> context) throws Exception {
if (stepLogger == null) {
stepLogger = DisabledStepLogger.INSTANCE;
}
Expand Down Expand Up @@ -192,7 +167,12 @@ public final JSONObject execute(StepLogger stepLogger, Map<String, Object> conte
return null;
}

return stepContext.getModel().getResultStatusObject();
final JSONObject resultStatusObject = stepContext.getModel().getResultStatusObject();
if (resultStatusObject == null) {
return null;
} else {
return ResultStatusObject.fromJsonObject(resultStatusObject);
}
}

/**
Expand Down Expand Up @@ -236,7 +216,6 @@ public void addEncryptedRequest(StepContext<M, R> stepContext, String applicatio
* @throws Exception when an error during encryption of the request data occurred
*/
public void addEncryptedRequest(StepContext<M, R> stepContext, ClientEncryptor encryptor, byte[] data) throws Exception {
M model = stepContext.getModel();
SimpleSecurityContext securityContext = (SimpleSecurityContext) stepContext.getSecurityContext();
if (securityContext == null) {
stepContext.setSecurityContext(
Expand Down Expand Up @@ -306,8 +285,8 @@ public void processResponse(StepContext<M, R> stepContext) throws Exception { }
* @throws Exception when an error during response processing occurred
*/
public final void processResponse(StepContext<M, R> stepContext, byte[] responseBody, Class<R> responseObjectClass) throws Exception {
R responseBodyObject = HttpUtil.fromBytes(responseBody, responseObjectClass);
ResponseEntity<R> responseEntity = ResponseEntity.of(Optional.of(responseBodyObject));
final R responseBodyObject = HttpUtil.fromBytes(responseBody, responseObjectClass);
final ResponseEntity<R> responseEntity = ResponseEntity.ofNullable(responseBodyObject);
addResponseContext(stepContext, responseEntity);
processResponse(stepContext);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import io.getlime.security.powerauth.lib.cmd.consts.PowerAuthStep;
import io.getlime.security.powerauth.lib.cmd.consts.PowerAuthVersion;
import io.getlime.security.powerauth.lib.cmd.logging.StepLogger;
import io.getlime.security.powerauth.lib.cmd.steps.pojo.ResultStatusObject;

import java.util.List;
Expand All @@ -34,11 +35,12 @@ public interface BaseStep {
/**
* Execute this step with given context objects.
*
* @param stepLogger Step logger.
* @param context Context objects.
* @return Result status object (with current activation status), null in case of failure.
* @throws Exception In case of a failure.
*/
ResultStatusObject execute(Map<String, Object> context) throws Exception;
ResultStatusObject execute(StepLogger stepLogger, Map<String, Object> context) throws Exception;

/**
* @return Corresponding PowerAuth step
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ public void setServerPublicKey(String serverPublicKey) {
*/
@JsonIgnore
public SecretKey getSignatureBiometryKeyObject() {
String signatureBiometryKey = (String) jsonObject.get("signatureBiometryKey");
final String signatureBiometryKey = (String) jsonObject.get("signatureBiometryKey");
if (signatureBiometryKey == null) {
return null;
}
return KEY_CONVERTOR.convertBytesToSharedSecretKey(Base64.getDecoder().decode(signatureBiometryKey));
}

Expand Down Expand Up @@ -290,7 +293,10 @@ public void setSignatureKnowledgeKeySalt(String signatureKnowledgeKeySalt) {
*/
@JsonIgnore
public SecretKey getSignaturePossessionKeyObject() {
String signaturePossessionKey = (String) jsonObject.get("signaturePossessionKey");
final String signaturePossessionKey = (String) jsonObject.get("signaturePossessionKey");
if (signaturePossessionKey == null) {
return null;
}
return KEY_CONVERTOR.convertBytesToSharedSecretKey(Base64.getDecoder().decode(signaturePossessionKey));
}

Expand Down Expand Up @@ -324,7 +330,10 @@ public void setSignaturePossessionKey(String signaturePossessionKey) {
*/
@JsonIgnore
public SecretKey getTransportMasterKeyObject() {
String transportMasterKey = (String) jsonObject.get("transportMasterKey");
final String transportMasterKey = (String) jsonObject.get("transportMasterKey");
if (transportMasterKey == null) {
return null;
}
return KEY_CONVERTOR.convertBytesToSharedSecretKey(Base64.getDecoder().decode(transportMasterKey));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public StepContext<ConfirmRecoveryCodeStepModel, EciesEncryptedResponse> prepare
public void processResponse(StepContext<ConfirmRecoveryCodeStepModel, EciesEncryptedResponse> stepContext) throws Exception {
final ConfirmRecoveryResponsePayload confirmResponsePayload = decryptResponse(stepContext, ConfirmRecoveryResponsePayload.class);
Map<String, Object> objectMap = new HashMap<>();
objectMap.put("alreadyConfirmed", confirmResponsePayload.getAlreadyConfirmed());
objectMap.put("alreadyConfirmed", confirmResponsePayload.isAlreadyConfirmed());

stepContext.getStepLogger().writeItem(
getStep().id() + "-confirmation-done",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package io.getlime.security.powerauth.lib.cmd.steps.v3;

import com.google.common.collect.ImmutableMap;
import io.getlime.security.powerauth.crypto.lib.encryptor.model.EncryptorId;
import io.getlime.security.powerauth.lib.cmd.consts.BackwardCompatibilityConst;
import io.getlime.security.powerauth.lib.cmd.consts.PowerAuthConst;
Expand Down Expand Up @@ -119,11 +118,8 @@ public void processResponse(StepContext<CreateTokenStepModel, EciesEncryptedResp
"Token successfully obtained",
"Token was successfully generated and decrypted",
"OK",
ImmutableMap.<String, Object>builder()
.put("tokenId", tokenResponsePayload.getTokenId())
.put("tokenSecret", tokenResponsePayload.getTokenSecret())
.build()

Map.of("tokenId", tokenResponsePayload.getTokenId(),
"tokenSecret",tokenResponsePayload.getTokenSecret())
);
}

Expand Down
Loading