Uh oh!
There was an error while loading. Please reload this page.
HDDS-3161. Block illegal characters when creating keys. - #812
Conversation
elek
commented
Apr 17, 2020
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)... |
Uh oh!
There was an error while loading. Please reload this page.
a39cfce to
6fba436CompareThanks to @elek for the comments and @mukul1987 for the review. I referenced the commit and review comments for this pull request(#718), implemented the key name check at In the newly submitted patch, I fixed some of the requests for missing check names, and I tested the put file through OzoneFS and it worked. |
adoroszlai
left a comment
There was a problem hiding this comment.
Thanks @cku328 for working on this.
My 2 cents: I would prefer this check to be optional, as a convenience for users who want to make sure key names are compatible with a wider range of tools. It could be enabled eg. by a flag in Ozone clients, or some global or volume/bucket-level config. But making it mandatory might break some use cases.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Neo <cku328@gmail.com>
Signed-off-by: Neo <cku328@gmail.com>
cku328
commented
Apr 24, 2020
Thanks @adoroszlai for the review. In |
adoroszlai
left a comment
There was a problem hiding this comment.
Thanks @cku328 for updating the patch and making this check optional. Tested ozone sh and ozone fs with both enabled and disabled config setting, works fine.
| throw new IllegalArgumentException("key name contains " + | ||
| "illegal characters."); |
There was a problem hiding this comment.
I would like to propose making this message consistent with the one in OmUtils, so that ozone fs -put and ozone sh key put both print the same error. I think it can be most simply done by moving the message from OmUtils here and letting the OMException propagate the underlying exception's message.
| thrownewIllegalArgumentException("key name contains " + | |
| "illegal characters."); | |
| thrownewIllegalArgumentException("Invalid key name: " + keyName); |
If you agree, please feel free to wait for others' reviews before making this change, to reduce the number of rounds.
There was a problem hiding this comment.
Thanks for the suggestion, I agree with you.
I'll wait for others' reviews and suggestions before I make this change.
| try { | ||
| HddsClientUtils.verifyKeyName(keyName); | ||
| } catch (IllegalArgumentException e) { | ||
| throw new OMException("Invalid key name: " + keyName, |
There was a problem hiding this comment.
Corresponding to the suggestion for HddsClientUtils:
| thrownewOMException("Invalid key name: " + keyName, | |
| thrownewOMException(e.getMessage(), |
# Conflicts: # hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java # hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java
cku328
commented
May 5, 2020
Update message of exception and resolve conflict. (latest master-branch #399) |
elek
commented
Jun 24, 2020
This patch seems to be reviewed and all the comments are addressed. Will merge it if no objections. I resolved the conflicts and started a new build to get a green build with the latest master. |
elek
commented
Jun 30, 2020
🎵 Green build, green build, tada-tada-tada... 🎵 Merging it right now, tada-tada-tada 🎵 Thanks the patch @cku328 (and sorry for the long review time) and the review @adoroszlai |

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, 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?