adoroszlai commented on code in PR #11313: URL: https://github.com/apache/ozone/pull/11313#discussion_r4090989252
########## hadoop-hdds/docs/content/security/SecurityAcls.md: ########## @@ -176,7 +176,7 @@ ACL user:testuser:r[DEFAULT] removed successfully. Ozone ACLs and S3 ACLs differ primarily in their scope and support. -- **S3 ACLs**: Currently, only S3 Bucket ACL is implemented in Ozone (a beta feature). S3 Object ACL is not yet implemented. Any `PutObjectAcl` request will result in a `501: Not Implemented` response code. +- **S3 ACLs**: Currently, only S3 Bucket ACL is implemented in Ozone (a beta feature). S3 Object ACL is not yet implemented. Any `GetObjectAcl` or `PutObjectAcl` request will result in a `501: Not Implemented` response code. Review Comment: Please don't update docs here, they are being removed in #10829. Update it, if needed, in `ozone-site` repo. ########## hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/ObjectNotImplementedHandler.java: ########## @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.ozone.s3.endpoint; + +import com.google.common.collect.ImmutableSet; +import java.io.InputStream; +import java.util.Set; +import javax.ws.rs.core.Response; +import org.apache.hadoop.ozone.s3.endpoint.ObjectEndpoint.ObjectRequestContext; +import org.apache.hadoop.ozone.s3.util.S3Consts.QueryParams; + +/** + * Rejects object subresource operations that are not implemented. + * <p> + * Must be added to the chain after the handlers of specific subresources ({@link ObjectAclHandler}, + * {@link ObjectAttributesHandler}, {@link ObjectGetTorrentHandler}, {@link ObjectTaggingHandler}, + * {@link MultipartKeyHandler}), etc. so that it only sees the HTTP methods those handlers do not handle, e.g. DELETE + * {@code ?acl} or PUT {@code ?attributes}. Otherwise, the requests fall through to another operation of the same HTTP + * method: a GET returns the object body, a PUT overwrites the object with the request body and a DELETE deletes it. + * <p> + * {@code ?uploads} is only valid for POST ({@code CreateMultipartUpload}), which does not go through this chain. + */ +class ObjectNotImplementedHandler extends ObjectOperationHandler { + + private static final Set<String> SUBRESOURCES = ImmutableSet.of( + QueryParams.ACL, QueryParams.ANNOTATION, QueryParams.ATTRIBUTES, QueryParams.ENCRYPTION, QueryParams.LEGAL_HOLD, + QueryParams.RENAME_OBJECT, QueryParams.RETENTION, QueryParams.TORRENT, QueryParams.UPLOADS); Review Comment: I think it would be better to reject requests for subresources with existing partial implementation (`acl`, `attributes`, etc.) right in those handlers. To do so: - change default implementations in `...OperationHandler` to `throw` - change specific handlers to `return NOT_IMPLEMENTED` by default in `getAction()` instead of `null` `...NotImplementedHandler` could be retained for subresources that are not handled at all. nit: rename to `...OperationNotImplementedHandler` (Where `...` is one of `Bucket` / `Object`.) -- 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]
