-
Notifications
You must be signed in to change notification settings - Fork 17
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
Cbc UI d2 4454 cloud encryption operator #1175
Merged
cody-constine-ttd
merged 45 commits into
main
from
cbc-UID2-4454-cloud-encryption-operator
Jan 9, 2025
Merged
Changes from 28 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
0a1154c
configs+initiate s3 key provider
lizk886 582ea54
small changes
lizk886 590b67e
update client
lizk886 e06509a
update shared repo
lizk886 275e5cb
keep origional constuctor
lizk886 4ef6e87
fix https
lizk886 7c25f1c
working
lizk886 12131f9
clean up
lizk886 1d85892
clean up
lizk886 08bf71a
clean up
lizk886 4c10d2d
clean up
lizk886 d106180
clean up
lizk886 195ec0d
push pom
lizk886 8700b1f
update configs to extreme big number
lizk886 20481ef
refactor
lizk886 88f2716
refactor'
lizk886 8975886
update shared
lizk886 fc96012
only be able to decrypt keyset and keyset_keys, needs to figure out w…
lizk886 1083e59
update
lizk886 18ccab1
update with unit tests
lizk886 578992c
update site
lizk886 264eefe
Merging up to main
cody-constine-ttd 3343974
Merge branch 'wzh-uid2-3573-call-endpoint-for-s3encyrptionkeys-list' …
cody-constine-ttd a0a099c
Merging
cody-constine-ttd 07f4da8
Catching up to rename changes
cody-constine-ttd eb0fd11
Renaming + adding get version for api key class
cody-constine-ttd aad4592
Renaming and adding small fixes
cody-constine-ttd bc2d667
Catching up to main
cody-constine-ttd 5922a29
Updated the API readed to make simplier
cody-constine-ttd 5383c0b
Adding new readers for salts and client side keypairs
cody-constine-ttd bfe7849
Finishing salts and clientside keys
cody-constine-ttd 9c9b1b9
Adding new constructor to rotatingCloudEncryptionProvider
cody-constine-ttd 3452457
Updating shared
cody-constine-ttd fd2c0c5
[CI Pipeline] Released Snapshot version: 5.42.1-alpha-144-SNAPSHOT
d075362
Adding new operator version
cody-constine-ttd 1a8635f
[CI Pipeline] Released Snapshot version: 5.42.1-alpha-145-SNAPSHOT
0740739
Merging up to main
cody-constine-ttd d2e25af
[CI Pipeline] Released Snapshot version: 5.43.5-alpha-146-SNAPSHOT
bdcaf8b
[CI Pipeline] Released Snapshot version: 5.43.6-alpha-147-SNAPSHOT
33763cc
Adding all the configs for private operators
cody-constine-ttd e63d5e2
Merge branch 'cbc-UID2-4454-cloud-encryption-operator' of github.com:…
cody-constine-ttd 5163db8
Upping the default cloud encryption rotation interval
cody-constine-ttd 233d9aa
Addressing last PR comments and updating shared
cody-constine-ttd a6700aa
Merge branch 'main' into cbc-UID2-4454-cloud-encryption-operator
cody-constine-ttd 14360fe
[CI Pipeline] Released Snapshot version: 5.44.7-alpha-148-SNAPSHOT
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/com/uid2/operator/reader/ApiStoreReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.uid2.operator.reader; | ||
|
||
import com.uid2.shared.cloud.DownloadCloudStorage; | ||
import com.uid2.shared.store.ScopedStoreReader; | ||
import com.uid2.shared.store.parser.Parser; | ||
import com.uid2.shared.store.parser.ParsingResult; | ||
import com.uid2.shared.store.scope.StoreScope; | ||
import io.vertx.core.json.JsonArray; | ||
import io.vertx.core.json.JsonObject; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.InputStream; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
public class ApiStoreReader<T> extends ScopedStoreReader<T> { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(ApiStoreReader.class); | ||
|
||
public ApiStoreReader(DownloadCloudStorage fileStreamProvider, StoreScope scope, Parser<T> parser, String dataTypeName) { | ||
super(fileStreamProvider, scope, parser, dataTypeName); | ||
} | ||
|
||
@Override | ||
public long loadContent(JsonObject contents, String dataType) throws Exception { | ||
if (contents == null) { | ||
throw new IllegalArgumentException(String.format("No contents provided for loading data type %s, cannot load content", dataType)); | ||
} | ||
|
||
try { | ||
JsonArray dataArray = contents.getJsonArray(dataType); | ||
if (dataArray == null) { | ||
throw new IllegalArgumentException("No array found in the contents"); | ||
} | ||
|
||
String jsonString = dataArray.toString(); | ||
InputStream inputStream = new ByteArrayInputStream(jsonString.getBytes(StandardCharsets.UTF_8)); | ||
|
||
ParsingResult<T> parsed = parser.deserialize(inputStream); | ||
latestSnapshot.set(parsed.getData()); | ||
|
||
final int count = parsed.getCount(); | ||
latestEntryCount.set(count); | ||
LOGGER.info(String.format("Loaded %d %s", count, dataTypeName)); | ||
return count; | ||
} catch (Exception e) { | ||
LOGGER.error(String.format("Unable to load %s", dataTypeName)); | ||
throw e; | ||
} | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
src/main/java/com/uid2/operator/reader/RotatingCloudEncryptionKeyApiProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.uid2.operator.reader; | ||
|
||
import com.uid2.shared.cloud.DownloadCloudStorage; | ||
import com.uid2.shared.model.CloudEncryptionKey; | ||
import com.uid2.shared.store.CloudPath; | ||
import com.uid2.shared.store.parser.CloudEncryptionKeyParser; | ||
import com.uid2.shared.store.reader.RotatingCloudEncryptionKeyProvider; | ||
import com.uid2.shared.store.scope.StoreScope; | ||
import io.vertx.core.json.JsonObject; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.time.Instant; | ||
import java.util.*; | ||
|
||
public class RotatingCloudEncryptionKeyApiProvider extends RotatingCloudEncryptionKeyProvider { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(RotatingCloudEncryptionKeyApiProvider.class); | ||
|
||
public ApiStoreReader<Map<Integer, CloudEncryptionKey>> apiStoreReader; | ||
cody-constine-ttd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
public RotatingCloudEncryptionKeyApiProvider(DownloadCloudStorage fileStreamProvider, StoreScope scope) { | ||
super(fileStreamProvider, scope); | ||
this.apiStoreReader = new ApiStoreReader<>(fileStreamProvider, scope, new CloudEncryptionKeyParser(), "cloud_encryption_keys"); | ||
} | ||
|
||
@Override | ||
public JsonObject getMetadata() throws Exception { | ||
return apiStoreReader.getMetadata(); | ||
} | ||
|
||
@Override | ||
public CloudPath getMetadataPath() { | ||
return apiStoreReader.getMetadataPath(); | ||
} | ||
|
||
@Override | ||
public long loadContent(JsonObject metadata) throws Exception { | ||
return apiStoreReader.loadContent(metadata, "cloudEncryptionKeys"); | ||
} | ||
|
||
@Override | ||
public long getVersion(JsonObject metadata) { | ||
return Instant.now().getEpochSecond(); | ||
cody-constine-ttd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
@Override | ||
public Map<Integer, CloudEncryptionKey> getAll() { | ||
Map<Integer, CloudEncryptionKey> keys = apiStoreReader.getSnapshot(); | ||
return keys != null ? keys : new HashMap<>(); | ||
} | ||
|
||
@Override | ||
public void loadContent() throws Exception { | ||
this.loadContent(this.getMetadata()); | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
src/main/resources/com.uid2.core/test/cloud_encryption_keys/cloud_encryption_keys.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
[ { | ||
cody-constine-ttd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"id" : 1, | ||
"siteId" : 999, | ||
"activates" : 1720641670, | ||
"created" : 1720641670, | ||
"secret" : "mydrCudb2PZOm01Qn0SpthltmexHUAA11Hy1m+uxjVw=" | ||
}, { | ||
"id" : 2, | ||
"siteId" : 999, | ||
"activates" : 1720728070, | ||
"created" : 1720641670, | ||
"secret" : "FtdslrFSsvVXOuhOWGwEI+0QTkCvM8SGZAP3k2u3PgY=" | ||
}, { | ||
"id" : 3, | ||
"siteId" : 999, | ||
"activates" : 1720814470, | ||
"created" : 1720641670, | ||
"secret" : "/7zO6QbKrhZKIV36G+cU9UR4hZUVg5bD+KjbczICjHw=" | ||
}, { | ||
"id" : 4, | ||
"siteId" : 123, | ||
"activates" : 1720641671, | ||
"created" : 1720641671, | ||
"secret" : "XjiqRlWQQJGLr7xfV1qbueKwyzt881GVohuUkQt/ht4=" | ||
}, { | ||
"id" : 5, | ||
"siteId" : 123, | ||
"activates" : 1720728071, | ||
"created" : 1720641671, | ||
"secret" : "QmpIf5NzO+UROjl5XjB/BmF6paefM8n6ub9B2plC9aI=" | ||
}, { | ||
"id" : 6, | ||
"siteId" : 123, | ||
"activates" : 1720814471, | ||
"created" : 1720641671, | ||
"secret" : "40w9UMSYxGm+KldOWOXhBGI8QgjvUUQjivtkP4VpKV8=" | ||
}, { | ||
"id" : 7, | ||
"siteId" : 124, | ||
"activates" : 1720641671, | ||
"created" : 1720641671, | ||
"secret" : "QdwD0kQV1BwmLRD0PH1YpqgaOrgpVTfu08o98mSZ6uE=" | ||
}, { | ||
"id" : 8, | ||
"siteId" : 124, | ||
"activates" : 1720728071, | ||
"created" : 1720641671, | ||
"secret" : "yCVCM/HLf9/6k+aUNrx7w17VbyfSzI8JykLQLSR+CW0=" | ||
}, { | ||
"id" : 9, | ||
"siteId" : 124, | ||
"activates" : 1720814471, | ||
"created" : 1720641671, | ||
"secret" : "JqHl8BrTyx9XpR2lYj/5xvUpzgnibGeomETTwF4rn1U=" | ||
}, { | ||
"id" : 10, | ||
"siteId" : 127, | ||
"activates" : 1720641671, | ||
"created" : 1720641671, | ||
"secret" : "JqiG1b34AvrdO3Aj6cCcjOBJMijrDzTmrR+p9ZtP2es=" | ||
}, { | ||
"id" : 11, | ||
"siteId" : 127, | ||
"activates" : 1720728072, | ||
"created" : 1720641672, | ||
"secret" : "lp1CyHdfc7K0aO5JGpA+Ve5Z/V5LImtGEQwCg/YB0kY=" | ||
}, { | ||
"id" : 12, | ||
"siteId" : 127, | ||
"activates" : 1720814472, | ||
"created" : 1720641672, | ||
"secret" : "G99rFYJF+dnSlk/xG6fuC3WNqQxTLJbDIdVyPMbGQ6s=" | ||
} ] |
7 changes: 7 additions & 0 deletions
7
src/main/resources/com.uid2.core/test/cloud_encryption_keys/metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be useful to include the dataType in the error message?