You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2019/05/17 13:44:31 UTC

[GitHub] [drill] agozhiy commented on a change in pull request #1788: DRILL-7204: Add proper validation when creating plugin

agozhiy commented on a change in pull request #1788: DRILL-7204: Add proper validation when creating plugin
URL: https://github.com/apache/drill/pull/1788#discussion_r285132072
 
 

 ##########
 File path: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java
 ##########
 @@ -204,6 +204,13 @@ public JsonResult createOrUpdatePluginJSON(PluginConfigWrapper plugin) {
   @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
   @Produces(MediaType.APPLICATION_JSON)
   public JsonResult createOrUpdatePlugin(@FormParam("name") String name, @FormParam("config") String storagePluginConfig) {
+    name = name.trim();
+    if (name.isEmpty()) {
+      return message("Error (a storage name cannot be empty)");
+    }
+    if (!name.matches("^[a-zA-Z0-9._-]+$")) {
 
 Review comment:
   Changed the approach to escape special symbols instead of block them. 

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