Skip to content

Commit 3a2591f

Browse files
authored
Fix Spring Security deprecations after Spring Boot 3.3.8 upgrade (#169)
1 parent 5103170 commit 3a2591f

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
1212
### Quality
1313

1414
- Use no more `iexec-commons-poco` deprecated code in integration tests. (#163)
15+
- Fix Spring Security deprecations after Spring Boot 3.3.8 upgrade. (#169)
1516

1617
### Breaking API changes
1718

src/main/java/com/iexec/blockchain/chain/IexecHubService.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
package com.iexec.blockchain.chain;
1818

19-
import com.iexec.common.worker.result.ResultUtils;
2019
import com.iexec.commons.poco.chain.*;
2120
import com.iexec.commons.poco.utils.BytesUtils;
21+
import com.iexec.commons.poco.utils.HashUtils;
2222
import org.apache.commons.lang3.StringUtils;
2323
import org.springframework.stereotype.Service;
2424
import org.web3j.protocol.core.methods.response.TransactionReceipt;
@@ -64,11 +64,8 @@ public TransactionReceipt contribute(final String chainTaskId,
6464
final String workerpoolSignature,
6565
final String enclaveChallenge,
6666
final String enclaveSignature) throws Exception {
67-
final String resultHash = ResultUtils.computeResultHash(chainTaskId, resultDigest);
68-
final String resultSeal =
69-
ResultUtils.computeResultSeal(credentials.getAddress(),
70-
chainTaskId,
71-
resultDigest);
67+
final String resultHash = HashUtils.concatenateAndHash(chainTaskId, resultDigest);
68+
final String resultSeal = HashUtils.concatenateAndHash(credentials.getAddress(), chainTaskId, resultDigest);
7269

7370
return iexecHubContract
7471
.contribute(

src/main/java/com/iexec/blockchain/chain/WebSocketBlockchainListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ public WebSocketBlockchainListener(final ChainConfig chainConfig, final SignerSe
7272
@Scheduled(fixedRate = 5000)
7373
private void run() throws ConnectException {
7474
if (newHeads != null && !newHeads.isDisposed()) {
75-
log.debug("nothing to do");
7675
return;
7776
}
7877

78+
log.warn("web socket disconnection detected");
7979
webSocketService.connect();
8080

8181
final Request<?, EthSubscribe> newHeadsRequest = new Request<>(
@@ -91,14 +91,14 @@ private void run() throws ConnectException {
9191
}
9292

9393
private void processHead(final NewHeadsNotification event) throws IOException {
94-
log.debug("processHead");
9594
final BigInteger blockNumber = Numeric.toBigInt(event.getParams().getResult().getNumber());
9695
lastSeenBlock.set(blockNumber.longValue());
9796
final BigInteger pendingTxCount = web3Client.ethGetTransactionCount(walletAddress,
9897
DefaultBlockParameterName.PENDING).send().getTransactionCount();
9998
final BigInteger latestTxCount = web3Client.ethGetTransactionCount(walletAddress,
10099
DefaultBlockParameterName.LATEST).send().getTransactionCount();
101-
log.info("Transaction count [pending:{}, latest:{}]", pendingTxCount, latestTxCount);
100+
log.info("Transaction count [block:{}, pending:{}, latest:{}]",
101+
lastSeenBlock, pendingTxCount, latestTxCount);
102102
pendingTxGauge.set(pendingTxCount.longValue());
103103
latestTxGauge.set(latestTxCount.longValue());
104104
}

src/main/java/com/iexec/blockchain/security/WebSecurityConfigurationAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.springframework.context.annotation.Configuration;
2121
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
2222
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
23+
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
2324
import org.springframework.security.web.SecurityFilterChain;
2425

2526
@Configuration
@@ -34,8 +35,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
3435
(or PUT/DELETE/PATCH) request with a valid CSRF token
3536
Will eventually activate it later.
3637
*/
37-
.csrf(csrf -> csrf.disable())
38-
.cors(cors -> cors.and())
38+
.csrf(AbstractHttpConfigurer::disable)
3939
.authorizeHttpRequests(auth -> auth
4040
.requestMatchers(
4141
"/swagger-ui.html",

0 commit comments

Comments
 (0)