FrankChen021 commented on code in PR #20540:
URL: https://github.com/apache/druid/pull/20540#discussion_r4270866570


##########
extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/ServerSideEncryptingAmazonS3.java:
##########
@@ -461,6 +469,30 @@ private static StaticCredentialsProvider 
createStaticCredentialsProvider(S3Input
     }
   }
 
+  /**
+   * Assumes an intermediate role if one is configured.
+   */
+  public static AwsCredentialsProvider maybeAssumeIntermediateRole(
+      AwsCredentialsProvider baseCredentialsProvider,
+      @Nullable S3IntermediateRoleConfig intermediateRoleConfig,
+      @Nullable AWSClientConfig awsClientConfig
+  )
+  {
+    final String intermediateAssumeRoleArn =
+        intermediateRoleConfig == null ? null : 
intermediateRoleConfig.getIntermediateAssumeRoleArn();
+    if (Strings.isNullOrEmpty(intermediateAssumeRoleArn)) {
+      return baseCredentialsProvider;
+    }
+
+    return createAssumeRoleCredentialsProvider(
+        intermediateAssumeRoleArn,
+        null,
+        null,

Review Comment:
   [P1] Preserve the configured STS signing region
   
   **Finding:** When an export destination or input source supplies 
endpointConfig.signingRegion but the process has no AWS_REGION, aws.region, or 
profile region, the target-role STS provider receives that region while this 
intermediate provider is created with null. The intermediate StsClient then 
cannot resolve a region, so every role-chained S3 operation fails before the 
target role is assumed.
   
   **Suggestion:** Pass the effective endpoint/signing-region configuration to 
the intermediate STS provider as well, and cover the no-ambient-region path.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to