Skip to content

Commit b16ec2a

Browse files
authored
Merge pull request #130 from iExecBlockchainComputing/release/8.4.0
Release/8.4.0
2 parents 3bcbdc9 + d238284 commit b16ec2a

File tree

21 files changed

+1277
-260
lines changed

21 files changed

+1277
-260
lines changed

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,36 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [[8.4.0]](https://github.com/iExecBlockchainComputing/iexec-result-proxy/releases/tag/v8.4.0) 2024-02-29
6+
7+
### Deprecation Notices
8+
9+
- Deprecate `/results/challenge` and `/results/login` endpoints. They will be removed in **v10**. (#119)
10+
- Deprecate `/` endpoint. Use `/v1/results` instead. The `/` endpoint will be removed in **v10**. (#119 #120)
11+
12+
### New Features
13+
14+
- Add `AuthorizationService` to enable `WorkerpoolAuthorization` validation. (#116)
15+
- Label REST API with `v1` version. (#120)
16+
- Add an endpoint to retrieve a JWT against a valid `WorkerpoolAuthorization`. (#123 #124)
17+
- Verify TEE tasks `enclaveSignature` before accepting IPFS upload. (#125 #126)
18+
- Persist `WorkerpoolAuthorization` instances to MongoDB. (#127)
19+
20+
### Bug Fixes
21+
22+
- Persist JWT signing key in dedicated `/data` folder by default. (#128)
23+
24+
### Quality
25+
26+
- Remove results download endpoints which are never used. (#117)
27+
- Add tests and javadoc on `ProxyController` class. (#118)
28+
- Remove `AbstractResultStorage` class. (#121)
29+
- Rework `ProxyService` class methods to use `ResultModel` as a parameter. (#122)
30+
31+
### Dependency Upgrades
32+
33+
- Upgrade to `iexec-common` 8.4.0. (#129)
34+
535
## [[8.3.0]](https://github.com/iExecBlockchainComputing/iexec-result-proxy/releases/tag/v8.3.0) 2024-01-10
636

737
### New Features

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ RUN groupadd --system appuser \
1313

1414
WORKDIR /app
1515
COPY $jar iexec-result-proxy.jar
16-
RUN chown -R appuser:appuser /app
16+
RUN mkdir /data
17+
RUN chown -R appuser:appuser /app /data
1718

1819
USER appuser
1920
ENTRYPOINT [ "java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "iexec-result-proxy.jar" ]

build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ plugins {
1111
ext {
1212
springCloudVersion = '2021.0.8'
1313
jjwtVersion = '0.11.5'
14+
testContainersVersion = '1.19.3'
1415
}
1516

1617
if (!project.hasProperty('gitBranch')) {
@@ -77,6 +78,10 @@ dependencies {
7778
// test
7879
testImplementation 'org.springframework.boot:spring-boot-starter-test'
7980
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
81+
82+
// mongo
83+
testImplementation "org.testcontainers:junit-jupiter:$testContainersVersion"
84+
testImplementation "org.testcontainers:mongodb:$testContainersVersion"
8085
}
8186

8287
dependencyManagement {
@@ -98,6 +103,7 @@ tasks.named("bootJar") {
98103

99104
test {
100105
useJUnitPlatform()
106+
systemProperty "mongo.image", "mongo:4.4.28-focal"
101107
}
102108

103109
tasks.register('itest') {

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
version=8.3.0
2-
iexecCommonVersion=8.3.1
1+
version=8.4.0
2+
iexecCommonVersion=8.4.0
33
iexecCommonsPocoVersion=3.2.0
44

55
nexusUser
Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2022-2024 IEXEC BLOCKCHAIN TECH
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,49 +17,54 @@
1717
package com.iexec.resultproxy.api;
1818

1919
import com.iexec.common.result.ResultModel;
20+
import com.iexec.commons.poco.chain.WorkerpoolAuthorization;
2021
import com.iexec.commons.poco.eip712.entity.EIP712Challenge;
2122
import feign.Headers;
2223
import feign.Param;
2324
import feign.RequestLine;
24-
import feign.Response;
2525

2626
/**
2727
* Interface allowing to instantiate a Feign client targeting Result Proxy REST endpoints.
2828
* <p>
2929
* To create the client, see the related builder.
30+
*
3031
* @see ResultProxyClientBuilder
3132
*/
3233
public interface ResultProxyClient {
3334

35+
/**
36+
* @deprecated Will be replaced with new flow and removed in v10
37+
*/
38+
@Deprecated(forRemoval = true)
3439
@RequestLine("GET /results/challenge?chainId={chainId}")
3540
EIP712Challenge getChallenge(@Param("chainId") int chainId);
3641

42+
/**
43+
* @deprecated Will be replaced with new flow and removed in v10
44+
*/
45+
@Deprecated(forRemoval = true)
3746
@RequestLine("POST /results/login?chainId={chainId}")
3847
String login(@Param("chainId") int chainId, String token);
3948

40-
@RequestLine("POST /")
49+
@RequestLine("POST /v1/results/token")
50+
@Headers("Authorization: {authorization}")
51+
String getJwt(@Param("authorization") String authorization, WorkerpoolAuthorization workerpoolAuthorization);
52+
53+
@RequestLine("POST /v1/results")
4154
@Headers("Authorization: {authorization}")
4255
String addResult(
4356
@Param("authorization") String authorization,
4457
ResultModel model
4558
);
4659

47-
@RequestLine("HEAD /results/{chainTaskId}")
60+
@RequestLine("HEAD /v1/results/{chainTaskId}")
4861
@Headers("Authorization: {authorization}")
4962
String isResultUploaded(
5063
@Param("authorization") String authorization,
5164
@Param("chainTaskId") String chainTaskId
5265
);
5366

54-
@RequestLine("GET /results/{chainTaskId}?chainId={chainId}")
55-
@Headers({"Accept: application/zip", "Authorization: {authorization}"})
56-
Response getResult(
57-
@Param("chainTaskId") String chainTaskId,
58-
@Param("authorization") String token,
59-
@Param("chainId") int chainId
60-
);
61-
62-
@RequestLine("GET /results/{chainTaskId}/ipfshash")
67+
@RequestLine("GET /v1/results/{chainTaskId}/ipfshash")
6368
String getIpfsHashForTask(@Param("chainTaskId") String chainTaskId);
6469

6570
}

iexec-result-proxy-library/src/test/java/com/iexec/resultproxy/api/ResultProxyClientTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2022-2024 IEXEC BLOCKCHAIN TECH
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
2020
import org.junit.jupiter.api.Assertions;
2121
import org.junit.jupiter.api.Test;
2222

23-
public class ResultProxyClientTest {
23+
class ResultProxyClientTest {
2424

2525
@Test
2626
void instantiationTest() {
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright 2020-2024 IEXEC BLOCKCHAIN TECH
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.iexec.resultproxy.authorization;
18+
19+
import com.iexec.commons.poco.chain.WorkerpoolAuthorization;
20+
import lombok.Getter;
21+
import lombok.NoArgsConstructor;
22+
import org.springframework.data.annotation.Id;
23+
import org.springframework.data.annotation.Version;
24+
import org.springframework.data.mongodb.core.index.CompoundIndex;
25+
import org.springframework.data.mongodb.core.mapping.Document;
26+
27+
@Document
28+
@CompoundIndex(name = "workerpool_authorization", def = "{'chainTaskId': 1, 'workerWallet': 1}", unique = true)
29+
@Getter
30+
@NoArgsConstructor
31+
public class Authorization {
32+
@Id
33+
private String id;
34+
35+
@Version
36+
private Long version;
37+
38+
private String chainTaskId;
39+
private String workerWallet;
40+
private String enclaveChallenge;
41+
42+
public Authorization(WorkerpoolAuthorization workerpoolAuthorization) {
43+
this.chainTaskId = workerpoolAuthorization.getChainTaskId();
44+
this.workerWallet = workerpoolAuthorization.getWorkerWallet();
45+
this.enclaveChallenge = workerpoolAuthorization.getEnclaveChallenge();
46+
}
47+
48+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2024-2024 IEXEC BLOCKCHAIN TECH
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.iexec.resultproxy.authorization;
18+
19+
public enum AuthorizationError {
20+
EMPTY_PARAMS_UNAUTHORIZED,
21+
NO_MATCH_ONCHAIN_TYPE,
22+
GET_CHAIN_TASK_FAILED,
23+
TASK_NOT_ACTIVE,
24+
GET_CHAIN_DEAL_FAILED,
25+
INVALID_SIGNATURE;
26+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2024-2024 IEXEC BLOCKCHAIN TECH
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.iexec.resultproxy.authorization;
18+
19+
import org.springframework.data.mongodb.repository.MongoRepository;
20+
21+
import java.util.Optional;
22+
23+
public interface AuthorizationRepository extends MongoRepository<Authorization, String> {
24+
Optional<Authorization> findByChainTaskIdAndWorkerWallet(String chainTaskId, String workerWallet);
25+
}

0 commit comments

Comments
 (0)