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/27 08:14:06 UTC

[GitHub] [drill] vvysotskyi commented on a change in pull request #1795: DRILL-7276: Fixed an XSS vulnerability in Drill Web-UI query profile …

vvysotskyi commented on a change in pull request #1795: DRILL-7276: Fixed an XSS vulnerability in Drill Web-UI query profile …
URL: https://github.com/apache/drill/pull/1795#discussion_r287689327
 
 

 ##########
 File path: exec/java-exec/src/main/resources/rest/alertModals.ftl
 ##########
 @@ -62,14 +62,18 @@
         var inputValuesKeys = Object.keys(inputValues);
         for (i=0; i<inputValuesKeys.length; ++i) {
             let currKey=inputValuesKeys[i];
-            updatedHtml=updatedHtml.replace(currKey, inputValues[currKey]);
+            updatedHtml=updatedHtml.replace(currKey, escapeHtml(inputValues[currKey]));
         }
         modalBody.innerHTML=updatedHtml;
       }
       //Show Alert
       $('#errorModal').modal('show');
     }
 
+    function escapeHtml(str) {
+        return str.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;') ;
 
 Review comment:
   Could you please escape other characters as it is described in [Cross Site Scripting Prevention Cheat Sheet](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.md#rule-1---html-escape-before-inserting-untrusted-data-into-html-element-content)?

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