You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/04/11 19:12:55 UTC

[GitHub] [hadoop-ozone] cku328 opened a new pull request #812: HDDS-3161. Block illegal characters when creating keys.

cku328 opened a new pull request #812: HDDS-3161. Block illegal characters when creating keys.
URL: https://github.com/apache/hadoop-ozone/pull/812
 
 
   ## What changes were proposed in this pull request?
   
   Added illegal character check (using regular expressions) for key name when creating key.
   
   For the definition of illegal characters, I refer to [Amazon S3's object key naming guide](https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html), which specifies the characters to avoid.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-3161
   
   ## How was this patch tested?
   
   - Ran UTs.
   - Using Ozone Shell to create a key with illegal characters in the name, errors can be detected, like this: 
   ![test](https://user-images.githubusercontent.com/14295594/79052750-358d0280-7c6b-11ea-9282-f2b8bf703dff.png)
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] elek commented on issue #812: HDDS-3161. Block illegal characters when creating keys.

Posted by GitBox <gi...@apache.org>.
elek commented on issue #812: HDDS-3161. Block illegal characters when creating keys.
URL: https://github.com/apache/hadoop-ozone/pull/812#issuecomment-615113337
 
 
   Thanks @cku328 to create this patch.  I am fine with following the S3 naming convention but not sure how will it work when buckets will be accessed from NFS/ozone fs. 
   
   What do you think @arp7 , can we do this restriction?
   
   From technical point of view: Didn't check the patch very closely, but it seems to be a client side check. I think it should be checked on the server side, too (but it might be included)...

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] mukul1987 commented on a change in pull request #812: HDDS-3161. Block illegal characters when creating keys.

Posted by GitBox <gi...@apache.org>.
mukul1987 commented on a change in pull request #812: HDDS-3161. Block illegal characters when creating keys.
URL: https://github.com/apache/hadoop-ozone/pull/812#discussion_r410070739
 
 

 ##########
 File path: hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
 ##########
 @@ -196,6 +196,27 @@ public static void verifyResourceName(String... resourceNames) {
     }
   }
 
+  /**
+   * verifies that key name is a valid name.
+   *
+   * @param keyName key name to be validated
+   *
+   * @throws IllegalArgumentException
+   */
+  public static void verifyKeyName(String keyName) {
+    if (keyName == null) {
+      throw new IllegalArgumentException("Key name is null");
+    }
+    String regex = "^[^^{}<>^?%~#`\\[\\]\\|\\\\(\\x80-\\xff)]$";
 
 Review comment:
   Please move this regex to OzoneConsts and please add a simplified example on what characters are not allowed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org