[ 
https://issues.apache.org/jira/browse/HDDS-2158?focusedWorklogId=321583&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-321583
 ]

ASF GitHub Bot logged work on HDDS-2158:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/Oct/19 22:10
            Start Date: 01/Oct/19 22:10
    Worklog Time Spent: 10m 
      Work Description: hanishakoneru commented on pull request #1486: 
HDDS-2158. Fixing Json Injection Issue in JsonUtils.
URL: https://github.com/apache/hadoop/pull/1486#discussion_r330298790
 
 

 ##########
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/keys/GetAclKeyHandler.java
 ##########
 @@ -78,8 +78,8 @@ public Void call() throws Exception {
 
     List<OzoneAcl> result = client.getObjectStore().getAcl(obj);
 
-    System.out.printf("%s%n", JsonUtils.toJsonStringWithDefaultPrettyPrinter(
-        JsonUtils.toJsonString(result)));
+    System.out.printf("%s%n",
+        JsonUtils.toJsonStringWithDefaultPrettyPrinter(result));
 
 Review comment:
   Yes, _toJsonStringWithDefaultPrettyPrinter_ converts to string but in Json 
format (with proper indentations and new line for each element). 
   Previously, we were converting the object to be printed to string (using 
_JsonUtils.toJsonString(result)_), then converting it back into object (inside 
old _toJsonStringWithDefaultPrettyPrinter()_) and then again converting it into 
string.
   ```
   //Old code
   public static String toJsonStringWithDefaultPrettyPrinter(String jsonString)
         throws IOException {
       Object json = READER.readValue(jsonString);
       return WRITTER.writeValueAsString(json);
     }
   ```
   The Json Injection issue happens when converting the jsonString back to 
Object without validation.
 
----------------------------------------------------------------
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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 321583)
    Time Spent: 2h 40m  (was: 2.5h)

> Fix Json Injection in JsonUtils
> -------------------------------
>
>                 Key: HDDS-2158
>                 URL: https://issues.apache.org/jira/browse/HDDS-2158
>             Project: Hadoop Distributed Data Store
>          Issue Type: Bug
>            Reporter: Hanisha Koneru
>            Assignee: Hanisha Koneru
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> JsonUtils#toJsonStringWithDefaultPrettyPrinter() does not validate the Json 
> StringĀ  before serializing it which could result in Json Injection.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to