You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by Madhan Neethiraj <ma...@apache.org> on 2021/07/08 22:59:13 UTC
Review Request 73444: RANGER-3332: script evaluator updated to provide
JavaScript style access to details of request/user/groups/tags
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73444/
-----------------------------------------------------------
Review request for ranger, Ankita Sinha, Don Bosco Durai, Abhay Kulkarni, Pradeep Agrawal, Ramesh Mani, Selvamohan Neethiraj, Sailaja Polavarapu, and Velmurugan Periasamy.
Bugs: RANGER-3332
https://issues.apache.org/jira/browse/RANGER-3332
Repository: ranger
Description
-------
Updated script condition evaluator to support JavaScript style access to request/user/groups/tags detail. For example:
- _ctx.request.clusterType == 'azure'
- _ctx.tag.type == 'PII' && _ctx.userAttributes.dept == 'hr'
- _ctx.tag.attributes.pii_type = 'email'
Diffs
-----
agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptConditionEvaluator.java b306f5150
agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptExecutionContext.java c0a8f9f35
agents-common/src/main/java/org/apache/ranger/plugin/util/RangerCommonConstants.java ed2dffd91
agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerCustomConditionMatcherTest.java 0a4dd4a02
Diff: https://reviews.apache.org/r/73444/diff/1/
Testing
-------
- added unit tests
Thanks,
Madhan Neethiraj
Re: Review Request 73444: RANGER-3332: script evaluator updated to
provide JavaScript style access to details of request/user/groups/tags
Posted by Madhan Neethiraj <ma...@apache.org>.
> On July 13, 2021, 12:54 a.m., Abhay Kulkarni wrote:
> > agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptExecutionContext.java
> > Lines 97 (patched)
> > <https://reviews.apache.org/r/73444/diff/1/?file=2251131#file2251131line97>
> >
> > Please consider measuring time spent in this method (and in Json.parse()) using perf logging - as for every script evaluation, both toJson and Json.parse() will be called.
added 2 perf traces:
1. toJson()
2. script execution. This covers Json.parse()
> On July 13, 2021, 12:54 a.m., Abhay Kulkarni wrote:
> > agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptExecutionContext.java
> > Lines 176 (patched)
> > <https://reviews.apache.org/r/73444/diff/1/?file=2251131#file2251131line176>
> >
> > Please ensure that com.google.gson.Gsoncom.google.gson.Gson
> > (used by JsonUtil class as a static singleton) is thread-safe.
JsonUtil class updated to use ThreadLocal gson objects.
- Madhan
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73444/#review223215
-----------------------------------------------------------
On July 14, 2021, 4:14 p.m., Madhan Neethiraj wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/73444/
> -----------------------------------------------------------
>
> (Updated July 14, 2021, 4:14 p.m.)
>
>
> Review request for ranger, Ankita Sinha, Don Bosco Durai, Abhay Kulkarni, Pradeep Agrawal, Ramesh Mani, Selvamohan Neethiraj, Sailaja Polavarapu, and Velmurugan Periasamy.
>
>
> Bugs: RANGER-3332
> https://issues.apache.org/jira/browse/RANGER-3332
>
>
> Repository: ranger
>
>
> Description
> -------
>
> Updated script condition evaluator to support JavaScript style access to request/user/groups/tags detail. For example:
> - _ctx.request.clusterType == 'azure'
> - _ctx.tag.type == 'PII' && _ctx.userAttributes.dept == 'hr'
> - _ctx.tag.attributes.pii_type = 'email'
>
>
> Diffs
> -----
>
> agents-common/src/main/java/org/apache/ranger/authorization/utils/JsonUtils.java ee4cef6d6
> agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptConditionEvaluator.java b306f5150
> agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptExecutionContext.java c0a8f9f35
> agents-common/src/main/java/org/apache/ranger/plugin/util/RangerCommonConstants.java ed2dffd91
> agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerCustomConditionMatcherTest.java 0a4dd4a02
>
>
> Diff: https://reviews.apache.org/r/73444/diff/2/
>
>
> Testing
> -------
>
> - added unit tests
>
>
> Thanks,
>
> Madhan Neethiraj
>
>
Re: Review Request 73444: RANGER-3332: script evaluator updated to
provide JavaScript style access to details of request/user/groups/tags
Posted by Abhay Kulkarni <ak...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73444/#review223215
-----------------------------------------------------------
agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptExecutionContext.java
Lines 97 (patched)
<https://reviews.apache.org/r/73444/#comment312314>
Please consider measuring time spent in this method (and in Json.parse()) using perf logging - as for every script evaluation, both toJson and Json.parse() will be called.
agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptExecutionContext.java
Lines 176 (patched)
<https://reviews.apache.org/r/73444/#comment312313>
Please ensure that com.google.gson.Gsoncom.google.gson.Gson
(used by JsonUtil class as a static singleton) is thread-safe.
- Abhay Kulkarni
On July 8, 2021, 10:59 p.m., Madhan Neethiraj wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/73444/
> -----------------------------------------------------------
>
> (Updated July 8, 2021, 10:59 p.m.)
>
>
> Review request for ranger, Ankita Sinha, Don Bosco Durai, Abhay Kulkarni, Pradeep Agrawal, Ramesh Mani, Selvamohan Neethiraj, Sailaja Polavarapu, and Velmurugan Periasamy.
>
>
> Bugs: RANGER-3332
> https://issues.apache.org/jira/browse/RANGER-3332
>
>
> Repository: ranger
>
>
> Description
> -------
>
> Updated script condition evaluator to support JavaScript style access to request/user/groups/tags detail. For example:
> - _ctx.request.clusterType == 'azure'
> - _ctx.tag.type == 'PII' && _ctx.userAttributes.dept == 'hr'
> - _ctx.tag.attributes.pii_type = 'email'
>
>
> Diffs
> -----
>
> agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptConditionEvaluator.java b306f5150
> agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptExecutionContext.java c0a8f9f35
> agents-common/src/main/java/org/apache/ranger/plugin/util/RangerCommonConstants.java ed2dffd91
> agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerCustomConditionMatcherTest.java 0a4dd4a02
>
>
> Diff: https://reviews.apache.org/r/73444/diff/1/
>
>
> Testing
> -------
>
> - added unit tests
>
>
> Thanks,
>
> Madhan Neethiraj
>
>
Re: Review Request 73444: RANGER-3332: script evaluator updated to
provide JavaScript style access to details of request/user/groups/tags
Posted by Abhay Kulkarni <ak...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73444/#review223252
-----------------------------------------------------------
Ship it!
Ship It!
- Abhay Kulkarni
On July 14, 2021, 4:14 p.m., Madhan Neethiraj wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/73444/
> -----------------------------------------------------------
>
> (Updated July 14, 2021, 4:14 p.m.)
>
>
> Review request for ranger, Ankita Sinha, Don Bosco Durai, Abhay Kulkarni, Pradeep Agrawal, Ramesh Mani, Selvamohan Neethiraj, Sailaja Polavarapu, and Velmurugan Periasamy.
>
>
> Bugs: RANGER-3332
> https://issues.apache.org/jira/browse/RANGER-3332
>
>
> Repository: ranger
>
>
> Description
> -------
>
> Updated script condition evaluator to support JavaScript style access to request/user/groups/tags detail. For example:
> - _ctx.request.clusterType == 'azure'
> - _ctx.tag.type == 'PII' && _ctx.userAttributes.dept == 'hr'
> - _ctx.tag.attributes.pii_type = 'email'
>
>
> Diffs
> -----
>
> agents-common/src/main/java/org/apache/ranger/authorization/utils/JsonUtils.java ee4cef6d6
> agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptConditionEvaluator.java b306f5150
> agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptExecutionContext.java c0a8f9f35
> agents-common/src/main/java/org/apache/ranger/plugin/util/RangerCommonConstants.java ed2dffd91
> agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerCustomConditionMatcherTest.java 0a4dd4a02
>
>
> Diff: https://reviews.apache.org/r/73444/diff/2/
>
>
> Testing
> -------
>
> - added unit tests
>
>
> Thanks,
>
> Madhan Neethiraj
>
>
Re: Review Request 73444: RANGER-3332: script evaluator updated to
provide JavaScript style access to details of request/user/groups/tags
Posted by Madhan Neethiraj <ma...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73444/
-----------------------------------------------------------
(Updated July 14, 2021, 4:14 p.m.)
Review request for ranger, Ankita Sinha, Don Bosco Durai, Abhay Kulkarni, Pradeep Agrawal, Ramesh Mani, Selvamohan Neethiraj, Sailaja Polavarapu, and Velmurugan Periasamy.
Changes
-------
addressed review comments
Bugs: RANGER-3332
https://issues.apache.org/jira/browse/RANGER-3332
Repository: ranger
Description
-------
Updated script condition evaluator to support JavaScript style access to request/user/groups/tags detail. For example:
- _ctx.request.clusterType == 'azure'
- _ctx.tag.type == 'PII' && _ctx.userAttributes.dept == 'hr'
- _ctx.tag.attributes.pii_type = 'email'
Diffs (updated)
-----
agents-common/src/main/java/org/apache/ranger/authorization/utils/JsonUtils.java ee4cef6d6
agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptConditionEvaluator.java b306f5150
agents-common/src/main/java/org/apache/ranger/plugin/conditionevaluator/RangerScriptExecutionContext.java c0a8f9f35
agents-common/src/main/java/org/apache/ranger/plugin/util/RangerCommonConstants.java ed2dffd91
agents-common/src/test/java/org/apache/ranger/plugin/conditionevaluator/RangerCustomConditionMatcherTest.java 0a4dd4a02
Diff: https://reviews.apache.org/r/73444/diff/2/
Changes: https://reviews.apache.org/r/73444/diff/1-2/
Testing
-------
- added unit tests
Thanks,
Madhan Neethiraj