You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by Abhishek Patil <pr...@gmail.com> on 2024/01/27 19:06:28 UTC

Review Request 74856: RANGER-4652: Value for datasets and projects field in the access audits must be JSON serializable

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/74856/
-----------------------------------------------------------

Review request for ranger, Madhan Neethiraj, Mehul Parikh, and Ramesh Mani.


Bugs: RANGER-4652
    https://issues.apache.org/jira/browse/RANGER-4652


Repository: ranger


Description
-------

Currently, the value for the datasets and the projects is not JSON serializable.
For e.g, the datasets field value is :- "[test_dataset_1]".
If the value needs to be converted to a JSON obj for parsing, it will result in an error.
The value needs to be "[\"test_dataset_1\"]".
This change is required for RANGER-4536.


Diffs
-----

  agents-common/src/main/java/org/apache/ranger/plugin/util/JsonUtilsV2.java 43e62a651 
  security-admin/src/main/java/org/apache/ranger/elasticsearch/ElasticSearchAccessAuditsService.java 4195567fa 
  security-admin/src/main/java/org/apache/ranger/solr/SolrAccessAuditsService.java 3485f4dba 


Diff: https://reviews.apache.org/r/74856/diff/1/


Testing
-------

1. Built Ranger in docker with the changes
2. Created a datashare, a dataset, linked both and performed an operation such that the access was allowed through a dataset policy.
   The value of the datasets field in the access audits was {"datasets": "[\"test_dataset_1\"]"}.
   This value can be parsed as a JSON object / array


Thanks,

Abhishek Patil


Re: Review Request 74856: RANGER-4652: Value for datasets and projects field in the access audits must be JSON serializable

Posted by Madhan Neethiraj <ma...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/74856/#review226175
-----------------------------------------------------------


Fix it, then Ship it!





security-admin/src/main/java/org/apache/ranger/elasticsearch/ElasticSearchAccessAuditsService.java
Lines 284 (patched)
<https://reviews.apache.org/r/74856/#comment314454>

    Please replace e.printStackTrace() with LOG.warn().


- Madhan Neethiraj


On Jan. 27, 2024, 7:06 p.m., Abhishek Patil wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/74856/
> -----------------------------------------------------------
> 
> (Updated Jan. 27, 2024, 7:06 p.m.)
> 
> 
> Review request for ranger, Madhan Neethiraj, Mehul Parikh, and Ramesh Mani.
> 
> 
> Bugs: RANGER-4652
>     https://issues.apache.org/jira/browse/RANGER-4652
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> Currently, the value for the datasets and the projects is not JSON serializable.
> For e.g, the datasets field value is :- "[test_dataset_1]".
> If the value needs to be converted to a JSON obj for parsing, it will result in an error.
> The value needs to be "[\"test_dataset_1\"]".
> This change is required for RANGER-4536.
> 
> 
> Diffs
> -----
> 
>   agents-common/src/main/java/org/apache/ranger/plugin/util/JsonUtilsV2.java 43e62a651 
>   security-admin/src/main/java/org/apache/ranger/elasticsearch/ElasticSearchAccessAuditsService.java 4195567fa 
>   security-admin/src/main/java/org/apache/ranger/solr/SolrAccessAuditsService.java 3485f4dba 
> 
> 
> Diff: https://reviews.apache.org/r/74856/diff/1/
> 
> 
> Testing
> -------
> 
> 1. Built Ranger in docker with the changes
> 2. Created a datashare, a dataset, linked both and performed an operation such that the access was allowed through a dataset policy.
>    The value of the datasets field in the access audits was {"datasets": "[\"test_dataset_1\"]"}.
>    This value can be parsed as a JSON object / array
> 
> 
> Thanks,
> 
> Abhishek Patil
> 
>


Re: Review Request 74856: RANGER-4652: Value for datasets and projects field in the access audits must be JSON serializable

Posted by Abhishek Patil <pr...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/74856/
-----------------------------------------------------------

(Updated Jan. 28, 2024, 5:10 a.m.)


Review request for ranger, Madhan Neethiraj, Mehul Parikh, and Ramesh Mani.


Changes
-------

Used LOGGER.warn instead of e.printStackTrace();


Bugs: RANGER-4652
    https://issues.apache.org/jira/browse/RANGER-4652


Repository: ranger


Description
-------

Currently, the value for the datasets and the projects is not JSON serializable.
For e.g, the datasets field value is :- "[test_dataset_1]".
If the value needs to be converted to a JSON obj for parsing, it will result in an error.
The value needs to be "[\"test_dataset_1\"]".
This change is required for RANGER-4536.


Diffs (updated)
-----

  agents-common/src/main/java/org/apache/ranger/plugin/util/JsonUtilsV2.java 43e62a651 
  security-admin/src/main/java/org/apache/ranger/elasticsearch/ElasticSearchAccessAuditsService.java 4195567fa 
  security-admin/src/main/java/org/apache/ranger/solr/SolrAccessAuditsService.java 3485f4dba 


Diff: https://reviews.apache.org/r/74856/diff/2/

Changes: https://reviews.apache.org/r/74856/diff/1-2/


Testing
-------

1. Built Ranger in docker with the changes
2. Created a datashare, a dataset, linked both and performed an operation such that the access was allowed through a dataset policy.
   The value of the datasets field in the access audits was {"datasets": "[\"test_dataset_1\"]"}.
   This value can be parsed as a JSON object / array


Thanks,

Abhishek Patil