Skip to content

Commit

Permalink
Merge pull request #148 from iExecBlockchainComputing/release/7.2.0
Browse files Browse the repository at this point in the history
Release/7.2.0
  • Loading branch information
jbern0rd authored Jan 9, 2023
2 parents b8707a8 + 68bdd64 commit cbca354
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 22 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

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

## [[7.2.0]](https://github.com/iExecBlockchainComputing/iexec-sms/releases/tag/v7.2.0) 2023-01-09

* Increments jenkins-library up to version 2.2.3. Enable SonarCloud analyses on branches and pull requests.
* Add `ReservedSecretKeyName` class to iexec-sms-library.

## [[7.1.1]](https://github.com/iExecBlockchainComputing/iexec-sms/releases/tag/v7.1.1) 2022-11-29

* Update build workflow to 2.1.4, update documentation in README and add CHANGELOG.
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@Library('global-jenkins-library@2.1.4') _
@Library('global-jenkins-library@2.2.3') _
buildJavaProject(
buildInfo: getBuildInfo(),
integrationTestsEnvVars: [],
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=7.1.1
version=7.2.0
iexecCommonVersion=6.0.0

nexusUser
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2022 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.iexec.sms.secret;

public class ReservedSecretKeyName {

//result encryption
public static final String IEXEC_RESULT_ENCRYPTION_PUBLIC_KEY = "iexec-result-encryption-public-key";
//result storage
public static final String IEXEC_RESULT_DROPBOX_TOKEN = "iexec-result-dropbox-token";
public static final String IEXEC_RESULT_IEXEC_IPFS_TOKEN = "iexec-result-iexec-ipfs-token";

private ReservedSecretKeyName() {}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

package com.iexec.sms.tee.session.palaemon;

import com.iexec.common.sms.secret.ReservedSecretKeyName;
import com.iexec.common.task.TaskDescription;
import com.iexec.common.tee.TeeEnclaveConfiguration;
import com.iexec.common.utils.FileHelper;
import com.iexec.common.utils.IexecEnvUtils;
import com.iexec.sms.secret.ReservedSecretKeyName;
import com.iexec.sms.secret.Secret;
import com.iexec.sms.secret.compute.OnChainObjectType;
import com.iexec.sms.secret.compute.SecretOwnerRole;
Expand Down Expand Up @@ -54,10 +54,10 @@
import static com.iexec.common.chain.DealParams.DROPBOX_RESULT_STORAGE_PROVIDER;
import static com.iexec.common.precompute.PreComputeUtils.IEXEC_DATASET_KEY;
import static com.iexec.common.precompute.PreComputeUtils.IS_DATASET_REQUIRED;
import static com.iexec.common.sms.secret.ReservedSecretKeyName.IEXEC_RESULT_ENCRYPTION_PUBLIC_KEY;
import static com.iexec.common.tee.TeeUtils.booleanToYesNo;
import static com.iexec.common.worker.result.ResultUtils.*;
import static com.iexec.sms.api.TeeSessionGenerationError.*;
import static com.iexec.sms.secret.ReservedSecretKeyName.IEXEC_RESULT_ENCRYPTION_PUBLIC_KEY;

@Slf4j
@Service
Expand Down
16 changes: 6 additions & 10 deletions src/main/java/com/iexec/sms/untee/secret/UnTeeSecretService.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,15 @@

import java.util.Optional;

import static com.iexec.common.sms.secret.ReservedSecretKeyName.IEXEC_RESULT_ENCRYPTION_PUBLIC_KEY;
import static com.iexec.sms.secret.ReservedSecretKeyName.IEXEC_RESULT_ENCRYPTION_PUBLIC_KEY;

@Service
@Slf4j
public class UnTeeSecretService {


private IexecHubService iexecHubService;
private Web3SecretService web3SecretService;
private Web2SecretsService web2SecretsService;
private final IexecHubService iexecHubService;
private final Web3SecretService web3SecretService;
private final Web2SecretsService web2SecretsService;

public UnTeeSecretService(IexecHubService iexecHubService,
Web3SecretService web3SecretService,
Expand All @@ -51,10 +50,8 @@ public UnTeeSecretService(IexecHubService iexecHubService,
}

/*
*
* Untested yet
*
* */
* Untested yet
*/
public Optional<TaskSecrets> getUnTeeTaskSecrets(String chainTaskId) {
TaskSecrets.TaskSecretsBuilder taskSecretsBuilder = TaskSecrets.builder();

Expand Down Expand Up @@ -97,5 +94,4 @@ public Optional<TaskSecrets> getUnTeeTaskSecrets(String chainTaskId) {
return Optional.of(taskSecretsBuilder.build());
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
package com.iexec.sms.tee.session.palaemon;

import com.iexec.common.precompute.PreComputeUtils;
import com.iexec.common.sms.secret.ReservedSecretKeyName;
import com.iexec.common.task.TaskDescription;
import com.iexec.common.tee.TeeEnclaveConfiguration;
import com.iexec.common.tee.TeeEnclaveConfigurationValidator;
import com.iexec.common.utils.FileHelper;
import com.iexec.common.utils.IexecEnvUtils;
import com.iexec.common.worker.result.ResultUtils;
import com.iexec.sms.api.TeeSessionGenerationError;
import com.iexec.sms.secret.ReservedSecretKeyName;
import com.iexec.sms.secret.Secret;
import com.iexec.sms.secret.compute.OnChainObjectType;
import com.iexec.sms.secret.compute.SecretOwnerRole;
Expand Down Expand Up @@ -56,8 +56,6 @@
import java.util.*;

import static com.iexec.common.chain.DealParams.DROPBOX_RESULT_STORAGE_PROVIDER;
import static com.iexec.common.sms.secret.ReservedSecretKeyName.IEXEC_RESULT_DROPBOX_TOKEN;
import static com.iexec.common.sms.secret.ReservedSecretKeyName.IEXEC_RESULT_ENCRYPTION_PUBLIC_KEY;
import static com.iexec.common.worker.result.ResultUtils.*;
import static com.iexec.sms.Web3jUtils.createEthereumAddress;
import static com.iexec.sms.api.TeeSessionGenerationError.*;
Expand Down Expand Up @@ -511,7 +509,8 @@ void shouldGetPostComputeStorageTokensOnIpfs() {
final TaskDescription taskDescription = sessionRequest.getTaskDescription();

final String secretValue = "Secret value";
when(web2SecretsService.getSecret(taskDescription.getRequester(), ReservedSecretKeyName.IEXEC_RESULT_IEXEC_IPFS_TOKEN, true))
when(web2SecretsService
.getSecret(taskDescription.getRequester(), ReservedSecretKeyName.IEXEC_RESULT_IEXEC_IPFS_TOKEN, true))
.thenReturn(Optional.of(new Secret(null, secretValue)));

final Map<String, String> tokens = assertDoesNotThrow(
Expand All @@ -535,7 +534,8 @@ void shouldGetPostComputeStorageTokensOnDropbox() {
taskDescription.setResultStorageProvider(DROPBOX_RESULT_STORAGE_PROVIDER);

final String secretValue = "Secret value";
when(web2SecretsService.getSecret(taskDescription.getRequester(), IEXEC_RESULT_DROPBOX_TOKEN, true))
when(web2SecretsService
.getSecret(taskDescription.getRequester(), ReservedSecretKeyName.IEXEC_RESULT_DROPBOX_TOKEN, true))
.thenReturn(Optional.of(new Secret(null, secretValue)));

final Map<String, String> tokens = assertDoesNotThrow(
Expand All @@ -557,7 +557,8 @@ void shouldNotGetPostComputeStorageTokensSinceNoSecret() {
final PalaemonSessionRequest sessionRequest = createSessionRequest(createTaskDescription());
final TaskDescription taskDescription = sessionRequest.getTaskDescription();

when(web2SecretsService.getSecret(taskDescription.getRequester(), ReservedSecretKeyName.IEXEC_RESULT_IEXEC_IPFS_TOKEN, true))
when(web2SecretsService
.getSecret(taskDescription.getRequester(), ReservedSecretKeyName.IEXEC_RESULT_IEXEC_IPFS_TOKEN, true))
.thenReturn(Optional.empty());

final TeeSessionGenerationException exception = assertThrows(
Expand Down Expand Up @@ -684,7 +685,7 @@ void shouldGetPostComputeEncryptionTokensWithEncryption() {
Secret publicKeySecret = new Secret("address", ENCRYPTION_PUBLIC_KEY);
when(web2SecretsService.getSecret(
request.getTaskDescription().getBeneficiary(),
IEXEC_RESULT_ENCRYPTION_PUBLIC_KEY,
ReservedSecretKeyName.IEXEC_RESULT_ENCRYPTION_PUBLIC_KEY,
true))
.thenReturn(Optional.of(publicKeySecret));

Expand Down Expand Up @@ -719,7 +720,7 @@ void shouldNotGetPostComputeEncryptionTokensSinceEmptyBeneficiaryKey() {

when(web2SecretsService.getSecret(
request.getTaskDescription().getBeneficiary(),
IEXEC_RESULT_ENCRYPTION_PUBLIC_KEY,
ReservedSecretKeyName.IEXEC_RESULT_ENCRYPTION_PUBLIC_KEY,
true))
.thenReturn(Optional.empty());

Expand Down

0 comments on commit cbca354

Please sign in to comment.