arina-ielchiieva 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_r284259374
 
 

 ##########
 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:
   We should also enforce such pattern when adding plugins from plugin override 
file during Drill start up.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to