[ 
https://issues.apache.org/jira/browse/DRILL-7204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16842182#comment-16842182
 ] 

ASF GitHub Bot commented on DRILL-7204:
---------------------------------------

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


> Add proper validation when creating plugin
> ------------------------------------------
>
>                 Key: DRILL-7204
>                 URL: https://issues.apache.org/jira/browse/DRILL-7204
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.16.0
>            Reporter: Arina Ielchiieva
>            Assignee: Anton Gozhiy
>            Priority: Major
>             Fix For: 1.17.0
>
>         Attachments: alert.JPG, new_plugin.png
>
>
> 1. Currently there is no failure when user attempts to create plugin without 
> name. Screenshot attached. I think we need proper plugin name validation when 
> creating plugin.
> 2. When disabling and deleting plugin, alerts are used. Its better to use 
> more user friendly message window. Screenshot attached.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to