dimas-b commented on code in PR #2802:
URL: https://github.com/apache/polaris/pull/2802#discussion_r2535083738
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/aws/AwsCredentialsStorageIntegration.java:
##########
@@ -239,7 +254,86 @@ private IamPolicy policyString(
bucketGetLocationStatementBuilder
.values()
.forEach(statementBuilder ->
policyBuilder.addStatement(statementBuilder.build()));
- return
policyBuilder.addStatement(allowGetObjectStatementBuilder.build()).build();
+ var r =
policyBuilder.addStatement(allowGetObjectStatementBuilder.build()).build();
+ LOGGER.info("Policies {}", r);
+ return r;
+ }
+
+ private static void addKmsKeyPolicy(
+ String kmsKeyArn,
+ List<String> allowedKmsKeys,
+ IamPolicy.Builder policyBuilder,
+ boolean canEncrypt,
+ String region,
+ String accountId) {
+
+ IamStatement.Builder allowKms = buildBaseKmsStatement(canEncrypt);
+ boolean hasCurrentKey = kmsKeyArn != null;
+ boolean hasAllowedKeys = hasAllowedKmsKeys(allowedKmsKeys);
+
+ if (hasCurrentKey) {
+ addKmsKeyResource(kmsKeyArn, allowKms);
+ }
+
+ if (hasAllowedKeys) {
+ addAllowedKmsKeyResources(allowedKmsKeys, allowKms);
+ }
+
+ // Add KMS statement if we have any KMS key configuration
+ if (hasCurrentKey || hasAllowedKeys) {
+ policyBuilder.addStatement(allowKms.build());
+ } else if (!canEncrypt) {
Review Comment:
the `canEncrypt` flag really means `canWrite`, does it not? 🤔
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]