Skip to content

Started the rename of core too #164

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

Merged
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
303a0f3
Started the rename of core too
cody-constine-ttd Nov 14, 2024
7bfc280
Upgrading workflows
cody-constine-ttd Nov 14, 2024
9f9123f
Merging up to main
cody-constine-ttd Nov 18, 2024
a76862f
Adding new version of shared
cody-constine-ttd Nov 18, 2024
2dc3d14
[CI Pipeline] Released Snapshot version: 2.20.15-alpha-53-SNAPSHOT
Nov 18, 2024
c82d3ec
Adding new version of shared
cody-constine-ttd Nov 18, 2024
f2e88da
Merge branch 'cbc-UID2-4379-rename-s3-encryption-cloud-encryption' of…
cody-constine-ttd Nov 18, 2024
fc8bdca
[CI Pipeline] Released Snapshot version: 2.20.16-alpha-54-SNAPSHOT
Nov 18, 2024
0ce46c4
Adding in new shared
cody-constine-ttd Nov 19, 2024
457cadd
Merge branch 'cbc-UID2-4379-rename-s3-encryption-cloud-encryption' of…
cody-constine-ttd Nov 19, 2024
63a2cb9
[CI Pipeline] Released Snapshot version: 2.20.17-alpha-56-SNAPSHOT
Nov 19, 2024
2986ca1
Removing the outdated google dep in core
cody-constine-ttd Nov 20, 2024
07027c3
Merge branch 'cbc-UID2-4379-rename-s3-encryption-cloud-encryption' of…
cody-constine-ttd Nov 20, 2024
ba5bce0
[CI Pipeline] Released Snapshot version: 2.20.18-alpha-57-SNAPSHOT
Nov 20, 2024
f122465
Upgrading shared
cody-constine-ttd Nov 20, 2024
53487f3
Merge branch 'cbc-UID2-4379-rename-s3-encryption-cloud-encryption' of…
cody-constine-ttd Nov 20, 2024
d8f167d
[CI Pipeline] Released Snapshot version: 2.20.19-alpha-58-SNAPSHOT
Nov 20, 2024
3224d44
Final shared version
cody-constine-ttd Nov 20, 2024
7063cfd
Merge branch 'cbc-UID2-4379-rename-s3-encryption-cloud-encryption' of…
cody-constine-ttd Nov 20, 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
2 changes: 1 addition & 1 deletion .github/workflows/check-stable-dependency.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ on: [pull_request, workflow_dispatch]

jobs:
check_dependency:
uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-check-stable-dependency.yaml@v2
uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-check-stable-dependency.yaml@v3
secrets: inherit
2 changes: 1 addition & 1 deletion conf/default-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"att_token_enc_key": null,
"att_token_enc_salt": null,
"enforceJwt": false,
"s3_keys_metadata_path": null
"cloud_encryption_keys_metadata_path": null
}
2 changes: 1 addition & 1 deletion conf/integ-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
"keyset_keys_metadata_path": "uid2/keyset_keys/metadata.json",
"salts_metadata_path": "uid2/salts/metadata.json",
"enforceJwt": false,
"s3_keys_metadata_path": "uid2/s3encryption_keys/metadata.json"
"cloud_encryption_keys_metadata_path": "uid2/cloud_encryption_keys/metadata.json"
}
2 changes: 1 addition & 1 deletion conf/local-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
"att_token_enc_salt": "<salt-for-attestation-token>",
"provide_private_site_data": true,
"enforceJwt": false,
"s3_keys_metadata_path": "/com.uid2.core/test/s3encryption_keys/metadata.json"
"cloud_encryption_keys_metadata_path": "/com.uid2.core/test/cloud_encryption_keys/metadata.json"
}
2 changes: 1 addition & 1 deletion conf/local-e2e-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
"aws_kms_jwt_signing_public_keys": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmvwB41qI5Fe41PDbXqcX5uOvSvfKh8l9QV0O3M+NsB4lKqQEP0t1hfoiXTpOgKz1ArYxHsQ2LeXifX4uwEbYJFlpVM+tyQkTWQjBOw6fsLYK2Xk4X2ylNXUUf7x3SDiOVxyvTh3OZW9kqrDBN9JxSoraNLyfw0hhW0SHpfs699SehgbQ7QWep/gVlKRLIz0XAXaZNw24s79ORcQlrCE6YD0PgQmpI/dK5xMML82n6y3qcTlywlGaU7OGIMdD+CTXA3BcOkgXeqZTXNaX1u6jCTa1lvAczun6avp5VZ4TFiuPo+y4rJ3GU+14cyT5NckEcaTKSvd86UdwK5Id9tl3bQIDAQAB",
"core_public_url": "http://localhost:8088",
"optout_url": "http://localhost:8081",
"s3_keys_metadata_path": "s3encryption_keys/metadata.json"
"cloud_keys_metadata_path": "cloud_encryption_keys/metadata.json"
}
2 changes: 1 addition & 1 deletion conf/local-e2e-docker-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
"aws_kms_jwt_signing_public_keys": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmvwB41qI5Fe41PDbXqcX5uOvSvfKh8l9QV0O3M+NsB4lKqQEP0t1hfoiXTpOgKz1ArYxHsQ2LeXifX4uwEbYJFlpVM+tyQkTWQjBOw6fsLYK2Xk4X2ylNXUUf7x3SDiOVxyvTh3OZW9kqrDBN9JxSoraNLyfw0hhW0SHpfs699SehgbQ7QWep/gVlKRLIz0XAXaZNw24s79ORcQlrCE6YD0PgQmpI/dK5xMML82n6y3qcTlywlGaU7OGIMdD+CTXA3BcOkgXeqZTXNaX1u6jCTa1lvAczun6avp5VZ4TFiuPo+y4rJ3GU+14cyT5NckEcaTKSvd86UdwK5Id9tl3bQIDAQAB",
"core_public_url": "http://core:8088",
"optout_url": "http://optout:8081",
"s3_keys_metadata_path": "s3encryption_keys/metadata.json"
"cloud_encryption_keys_metadata_path": "cloud_encryption_keys/metadata.json"
}
9 changes: 2 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.uid2</groupId>
<artifactId>uid2-core</artifactId>
<version>2.20.14</version>
<version>2.20.19-alpha-58-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -24,7 +24,7 @@
<vertx.verticle>com.uid2.core.vertx.CoreVerticle</vertx.verticle>
<launcher.class>io.vertx.core.Launcher</launcher.class>

<uid2-shared.version>7.21.7</uid2-shared.version>
<uid2-shared.version>7.21.12-alpha-165-SNAPSHOT</uid2-shared.version>
<image.version>${project.version}</image.version>
</properties>

Expand Down Expand Up @@ -97,11 +97,6 @@
<artifactId>vertx-web-client</artifactId>
<version>${vertx.version}</version>
</dependency>
<dependency>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-oauth2-http</artifactId>
<version>1.23.0</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-micrometer-metrics</artifactId>
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/com/uid2/core/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import com.uid2.shared.attest.JwtService;
import com.uid2.shared.auth.EnclaveIdentifierProvider;
import com.uid2.shared.auth.RotatingOperatorKeyProvider;
import com.uid2.shared.store.reader.RotatingS3KeyProvider;
import com.uid2.shared.model.S3Key;
import com.uid2.shared.store.reader.RotatingCloudEncryptionKeyProvider;
import com.uid2.shared.model.CloudEncryptionKey;
import com.uid2.shared.cloud.CloudUtils;
import com.uid2.shared.cloud.EmbeddedResourceStorage;
import com.uid2.shared.cloud.ICloudStorage;
Expand Down Expand Up @@ -106,7 +106,7 @@ public static void main(String[] args) {

RotatingStoreVerticle enclaveRotatingVerticle = null;
RotatingStoreVerticle operatorRotatingVerticle = null;
RotatingStoreVerticle s3KeyRotatingVerticle = null;
RotatingStoreVerticle cloudEncryptionKeyRotatingVerticle = null;
CoreVerticle coreVerticle = null;
try {
CloudPath operatorMetadataPath = new CloudPath(config.getString(Const.Config.OperatorsMetadataPathProp));
Expand All @@ -118,10 +118,10 @@ public static void main(String[] args) {
EnclaveIdentifierProvider enclaveIdProvider = new EnclaveIdentifierProvider(cloudStorage, enclaveMetadataPath);
enclaveRotatingVerticle = new RotatingStoreVerticle("enclaves", 60000, enclaveIdProvider);

CloudPath s3KeyMetadataPath = new CloudPath(config.getString(Const.Config.S3keysMetadataPathProp));
GlobalScope s3KeyScope = new GlobalScope(s3KeyMetadataPath);
RotatingS3KeyProvider s3KeyProvider = new RotatingS3KeyProvider(cloudStorage, s3KeyScope);
s3KeyRotatingVerticle = new RotatingStoreVerticle("s3encryption_keys", 60000, s3KeyProvider);
CloudPath cloudEncryptionKeyMetadataPath = new CloudPath(config.getString(Const.Config.CloudEncryptionKeysMetadataPathProp));
GlobalScope cloudEncryptionKeyScope = new GlobalScope(cloudEncryptionKeyMetadataPath);
RotatingCloudEncryptionKeyProvider cloudEncryptionKeyProvider = new RotatingCloudEncryptionKeyProvider(cloudStorage, cloudEncryptionKeyScope);
cloudEncryptionKeyRotatingVerticle = new RotatingStoreVerticle("cloud_encryption_keys", 60000, cloudEncryptionKeyProvider);

String corePublicUrl = ConfigStore.Global.get(Const.Config.CorePublicUrlProp);
AttestationService attestationService = new AttestationService()
Expand Down Expand Up @@ -157,15 +157,15 @@ public static void main(String[] args) {

JwtService jwtService = new JwtService(config);

coreVerticle = new CoreVerticle(cloudStorage, operatorKeyProvider, attestationService, attestationTokenService, enclaveIdProvider, operatorJWTTokenProvider, jwtService, s3KeyProvider);
coreVerticle = new CoreVerticle(cloudStorage, operatorKeyProvider, attestationService, attestationTokenService, enclaveIdProvider, operatorJWTTokenProvider, jwtService, cloudEncryptionKeyProvider);
} catch (Exception e) {
System.out.println("failed to initialize core verticle: " + e.getMessage());
System.exit(-1);
}

vertx.deployVerticle(enclaveRotatingVerticle);
vertx.deployVerticle(operatorRotatingVerticle);
vertx.deployVerticle(s3KeyRotatingVerticle);
vertx.deployVerticle(cloudEncryptionKeyRotatingVerticle);
vertx.deployVerticle(coreVerticle);
});
}
Expand Down
25 changes: 13 additions & 12 deletions src/main/java/com/uid2/core/vertx/CoreVerticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@
import java.time.Instant;
import java.util.*;

import com.uid2.shared.store.reader.RotatingS3KeyProvider;
import com.uid2.shared.model.S3Key;
import com.uid2.shared.store.reader.RotatingCloudEncryptionKeyProvider;
import com.uid2.shared.model.CloudEncryptionKey;


import static com.uid2.shared.Const.Config.EnforceJwtProp;

Expand Down Expand Up @@ -79,7 +80,7 @@ public class CoreVerticle extends AbstractVerticle {
private final ISaltMetadataProvider saltMetadataProvider;
private final IPartnerMetadataProvider partnerMetadataProvider;
private final OperatorJWTTokenProvider operatorJWTTokenProvider;
private final RotatingS3KeyProvider s3KeyProvider;
private final RotatingCloudEncryptionKeyProvider cloudEncryptionKeyProvider;

public CoreVerticle(ICloudStorage cloudStorage,
IAuthorizableProvider authProvider,
Expand All @@ -88,7 +89,7 @@ public CoreVerticle(ICloudStorage cloudStorage,
IEnclaveIdentifierProvider enclaveIdentifierProvider,
OperatorJWTTokenProvider operatorJWTTokenProvider,
JwtService jwtService,
RotatingS3KeyProvider s3KeyProvider) throws Exception {
RotatingCloudEncryptionKeyProvider cloudEncryptionKeyProvider) throws Exception {
this.operatorJWTTokenProvider = operatorJWTTokenProvider;
this.healthComponent.setHealthStatus(false, "not started");

Expand All @@ -98,7 +99,7 @@ public CoreVerticle(ICloudStorage cloudStorage,
this.attestationTokenService = attestationTokenService;
this.enclaveIdentifierProvider = enclaveIdentifierProvider;
this.enclaveIdentifierProvider.addListener(this.attestationService);
this.s3KeyProvider = s3KeyProvider;
this.cloudEncryptionKeyProvider = cloudEncryptionKeyProvider;

final String jwtAudience = ConfigStore.Global.get(Const.Config.CorePublicUrlProp);
final String jwtIssuer = ConfigStore.Global.get(Const.Config.CorePublicUrlProp);
Expand Down Expand Up @@ -178,7 +179,7 @@ private Router createRoutesSetup() {
router.post("/attest")
.handler(new AttestationFailureHandler())
.handler(auth.handle(this::handleAttestAsync, Role.OPERATOR, Role.OPTOUT_SERVICE));
router.get("/s3encryption_keys/retrieve").handler(auth.handle(attestationMiddleware.handle(this::handleS3EncryptionKeysRetrieval), Role.OPERATOR));
router.get("/cloud_encryption_keys/retrieve").handler(auth.handle(attestationMiddleware.handle(this::handleCloudEncryptionKeysRetrieval), Role.OPERATOR));
router.get("/sites/refresh").handler(auth.handle(attestationMiddleware.handle(this::handleSiteRefresh), Role.OPERATOR));
router.get("/key/refresh").handler(auth.handle(attestationMiddleware.handle(this::handleKeyRefresh), Role.OPERATOR));
router.get("/key/acl/refresh").handler(auth.handle(attestationMiddleware.handle(this::handleKeyAclRefresh), Role.OPERATOR));
Expand Down Expand Up @@ -609,24 +610,24 @@ private void handleEnclaveUnregister(RoutingContext rc) {
handleEnclaveChange(rc, true);
}

void handleS3EncryptionKeysRetrieval(RoutingContext rc) {
void handleCloudEncryptionKeysRetrieval(RoutingContext rc) {
try {
OperatorInfo info = OperatorInfo.getOperatorInfo(rc);
int siteId = info.getSiteId();
List<S3Key> s3Keys = s3KeyProvider.getKeys(siteId);
List<CloudEncryptionKey> cloudEncryptionKeys = cloudEncryptionKeyProvider.getKeys(siteId);

if (s3Keys == null || s3Keys.isEmpty()) {
Error("No S3 keys found", 500, rc, "No S3 keys found for siteId: " + siteId);
if (cloudEncryptionKeys == null || cloudEncryptionKeys.isEmpty()) {
Error("No Cloud Encryption keys found", 500, rc, "No Cloud Encryption keys found for siteId: " + siteId);
return;
}

JsonObject response = new JsonObject()
.put("s3Keys", new JsonArray(s3Keys));
.put("cloudEncryptionKeys", new JsonArray(cloudEncryptionKeys));

rc.response().putHeader(HttpHeaders.CONTENT_TYPE, "application/json")
.end(response.encode());
} catch (Exception e) {
logger.error("Error in handleRefreshS3Keys: ", e);
logger.error("Error in handleRefreshCloudEncryptionKeys: ", e);
Error("error", 500, rc, "error generating attestation token");
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"version": 1,
"generated": 1620253519,
"cloud_encryption_keys": {
"location": "/com.uid2.core/test/cloud_encryption_keys/cloud_encryption_keys.json"
}
}

This file was deleted.

Loading