[GitHub] [hadoop] bharatviswa504 commented on a change in pull request #1486: HDDS-2158. Fixing Json Injection Issue in JsonUtils.

2019-10-02 Thread GitBox
bharatviswa504 commented on a change in pull request #1486: HDDS-2158. Fixing 
Json Injection Issue in JsonUtils.
URL: https://github.com/apache/hadoop/pull/1486#discussion_r330754661
 
 

 ##
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/RemoveAclBucketHandler.java
 ##
 @@ -92,8 +92,9 @@ public Void call() throws Exception {
 boolean result = client.getObjectStore().removeAcl(obj,
 OzoneAcl.parseAcl(acl));
 
-System.out.printf("%s%n", JsonUtils.toJsonStringWithDefaultPrettyPrinter(
-JsonUtils.toJsonString("Acl removed successfully: " + result)));
+System.out.printf("%s%n", result ? "ACL removed successfully" :
+"ACL not removed");
 
 Review comment:
   From my understanding, addAcl behavior is if acl is added successfully 
returns true, it will return false when acl trying to be added already exists. 
   
   > 
   If we are trying to add an already existing ACL, shouldn't we return true?
   
   I think returning true is not right behavior, as it will not be clear 
whether add is successful or not. We should have returned with clear message to 
end user, what is differenece between true/false. 
   
   `But I think that statement also does not convey the message properly. `
   
   Agreed this was existing behavior, if you want to fix in a new Jira I am 
okay with that.
   


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

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



[GitHub] [hadoop] bharatviswa504 commented on a change in pull request #1486: HDDS-2158. Fixing Json Injection Issue in JsonUtils.

2019-10-01 Thread GitBox
bharatviswa504 commented on a change in pull request #1486: HDDS-2158. Fixing 
Json Injection Issue in JsonUtils.
URL: https://github.com/apache/hadoop/pull/1486#discussion_r330292320
 
 

 ##
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/RemoveAclBucketHandler.java
 ##
 @@ -92,8 +92,9 @@ public Void call() throws Exception {
 boolean result = client.getObjectStore().removeAcl(obj,
 OzoneAcl.parseAcl(acl));
 
-System.out.printf("%s%n", JsonUtils.toJsonStringWithDefaultPrettyPrinter(
-JsonUtils.toJsonString("Acl removed successfully: " + result)));
+System.out.printf("%s%n", result ? "ACL removed successfully" :
+"ACL not removed");
 
 Review comment:
   RemoveAcl returns false, when passedAcl is not existing, then it cannot be 
removed. Do we need to reword this to convey this?


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

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



[GitHub] [hadoop] bharatviswa504 commented on a change in pull request #1486: HDDS-2158. Fixing Json Injection Issue in JsonUtils.

2019-10-01 Thread GitBox
bharatviswa504 commented on a change in pull request #1486: HDDS-2158. Fixing 
Json Injection Issue in JsonUtils.
URL: https://github.com/apache/hadoop/pull/1486#discussion_r330291781
 
 

 ##
 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 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:
   I think this should be fine, as we are not converting to String and printing.


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

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



[GitHub] [hadoop] bharatviswa504 commented on a change in pull request #1486: HDDS-2158. Fixing Json Injection Issue in JsonUtils.

2019-10-01 Thread GitBox
bharatviswa504 commented on a change in pull request #1486: HDDS-2158. Fixing 
Json Injection Issue in JsonUtils.
URL: https://github.com/apache/hadoop/pull/1486#discussion_r330291781
 
 

 ##
 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 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:
   I think this should be fine, as we are not converting to String and 
printing. (Same for others too)


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

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



[GitHub] [hadoop] bharatviswa504 commented on a change in pull request #1486: HDDS-2158. Fixing Json Injection Issue in JsonUtils.

2019-10-01 Thread GitBox
bharatviswa504 commented on a change in pull request #1486: HDDS-2158. Fixing 
Json Injection Issue in JsonUtils.
URL: https://github.com/apache/hadoop/pull/1486#discussion_r330291228
 
 

 ##
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/AddAclBucketHandler.java
 ##
 @@ -92,8 +92,8 @@ public Void call() throws Exception {
 boolean result = client.getObjectStore().addAcl(obj,
 OzoneAcl.parseAcl(acl));
 
-System.out.printf("%s%n", JsonUtils.toJsonStringWithDefaultPrettyPrinter(
-JsonUtils.toJsonString("Acl set successfully: " + result)));
+System.out.printf("%s%n", result ? "ACL set successfully" : "ACL not set");
 
 Review comment:
   False means Acl passed is already existing, in this case we return false. So 
message `ACL not set `is meaningful here or do we need to reword this?
   


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

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



[GitHub] [hadoop] bharatviswa504 commented on a change in pull request #1486: HDDS-2158. Fixing Json Injection Issue in JsonUtils.

2019-09-24 Thread GitBox
bharatviswa504 commented on a change in pull request #1486: HDDS-2158. Fixing 
Json Injection Issue in JsonUtils.
URL: https://github.com/apache/hadoop/pull/1486#discussion_r327852770
 
 

 ##
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/web/ozShell/bucket/AddAclBucketHandler.java
 ##
 @@ -92,8 +92,9 @@ public Void call() throws Exception {
 boolean result = client.getObjectStore().addAcl(obj,
 OzoneAcl.parseAcl(acl));
 
-System.out.printf("%s%n", JsonUtils.toJsonStringWithDefaultPrettyPrinter(
-JsonUtils.toJsonString("Acl set successfully: " + result)));
+System.out.printf("%s%n", "Acl set successfully: " +
+JsonUtils.toJsonStringWithDefaultPrettyPrinter(result));
 
 Review comment:
   Here the result is true/false, we can directly print. Do we need 
toJsonStringWithDefaultPrettyPrinter here? Previously this was called with Acl 
set successfully: + result. But now just result, so is it okay if we directly 
use result to print?
   
   Same comment for all AclHandler classes.


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

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