smengcl commented on code in PR #11413:
URL: https://github.com/apache/ozone/pull/11413#discussion_r4191472634
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectAttributesHandler.java:
##########
@@ -124,6 +124,9 @@ Response handleGetRequest(ObjectRequestContext context,
String keyPath)
OzoneKey key;
NavigableMap<Integer, Long> completedPartSizes = null;
try {
+ // AWS requires the credentials to support both s3:GetObject and
s3:GetObjectAttributes actions. The
+ // main metadata request runs with GetObjectAttributes; perform the
dependent GetObject check first.
+ requireS3ActionString("GetObject", () ->
getClientProtocol().headS3Object(bucketName, keyPath));
Review Comment:
Does this add an extra OM RPC round trip to every GetObjectAttributes
request when STS is enabled? Is there a way to check both required actions
during the existing OM metadata lookup and avoid the second RPC?
##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestS3ActionOverrideForOwnerVerification.java:
##########
@@ -109,6 +126,31 @@ public void
testCopyObjectDoesNotSetActionWhenStsDisabled() throws Exception {
assertNull(actionAtSourceBucketOwnerLookup.get());
}
+ @ParameterizedTest
+ @ValueSource(strings = {"ETag", "ObjectParts"})
+ public void testGetObjectAttributesRequiresBothIamActions(String attribute)
throws Exception {
Review Comment:
Could we add a denied GetObject check for both ETag and ObjectParts? Have
the check throw PERMISSION_DENIED, assert AccessDenied, and verify that the
subsequent attributes lookup is not attempted. The smoke tests cover missing
permissions. This would verify the handler’s error translation and
short-circuit directly.
--
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]