Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Docs for using Marcos in row-level filter in Authz #3217

Closed
3 tasks done
bowenliang123 opened this issue Aug 11, 2022 · 12 comments
Closed
3 tasks done

[DOCS] Docs for using Marcos in row-level filter in Authz #3217

bowenliang123 opened this issue Aug 11, 2022 · 12 comments
Assignees
Labels
kind:documentation Documentation is a feature!
Milestone

Comments

@bowenliang123
Copy link
Contributor

bowenliang123 commented Aug 11, 2022

Code of Conduct

Search before asking

  • I have searched in the issues and found no similar issues.

Which parts of the documentation do you think need improvement?

Support macros in Row-filter condition expression, introduced in Ranger 2.3 (release notes), is an major feature to significantly simplify the row-filter condition expression in practice by replacing explicit condition query by using user/group's attributes.

  • RANGER-3605 : Support macros in row-filter/condition expressions
  • RANGER-3550 : support for using user/tag attributes in row-filter expressions and conditions

Consider user liangtiancheng with attribute born_city = guangzhou, we can define the row filter condition with city='${{USER.born_city}}' with the macro feature.

However, This feature implicit relies on an config named ranger.plugin.spark.enable.implicit.userstore.enricher and the default value false will prevent RangerUserStoreEnricher fetching user/group and their attributes. Macros in row-filter condition will fallback to null value (as lack of user attributes value in UserStore of auth context) in script transformation unexpectedly and imperceptibly.

Improving doc of ranger-spark-security.xml to aware of this feature and related config.

Affects Version(s)

1.6.0

Improving the documentation

By adding the config suggestion here in AuthZ plugin docs of sample ranger-spark-security.xml in https://github.com/apache/incubator-kyuubi/blob/master/docs/security/authorization/spark/install.md

<property>
        <name>ranger.plugin.spark.enable.implicit.userstore.enricher</name>
        <value>true</value>
       <description>Enable UserStoreEnricher for fetching user and group attributes if using marcros or scripts in row-filters since Ranger 2.3</description>
</property>

<property>
        <name>ranger.plugin.hive.policy.cache.dir</name>
        <value>./a ranger hive service name/policycache</value>
       <description>policycache cache path of hive service def for caching UserStore , Tags, etc.</description>
</property>

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@bowenliang123 bowenliang123 added the kind:documentation Documentation is a feature! label Aug 11, 2022
@bowenliang123 bowenliang123 changed the title [DOCS] Add config suggestion for Ragner userstore enricher in Authz doc [DOCS] Add Ranger UserStoreEnricher enable config suggestion in Authz Aug 11, 2022
@yaooqinn yaooqinn added this to the v1.6.0 milestone Aug 11, 2022
@yaooqinn
Copy link
Member

sounds nice.

@bowenliang123
Copy link
Contributor Author

Will submit a PR when matured at proper time.

@pan3793
Copy link
Member

pan3793 commented Aug 17, 2022

Hi, @bowenliang123, changed to milestone 1.7.0 because the community are going to release 1.6.0 recently

@pan3793 pan3793 modified the milestones: v1.6.0, v1.7.0 Aug 17, 2022
@bowenliang123
Copy link
Contributor Author

bowenliang123 commented Aug 17, 2022

@pan3793 alright.
What is the release date scheduled for 1.6.0? If it is close to end of Auguest, I should be able to catch up with it and submit an pr this week. The enrichment is not about to modify any code implementation other than docs.

@pan3793 pan3793 modified the milestones: v1.7.0, v1.6.0 Aug 17, 2022
@pan3793
Copy link
Member

pan3793 commented Aug 17, 2022

Great, 1.6.0 is expected to be out in late Aug. or early Sept. Changed it back to 1.6.0.

@bowenliang123
Copy link
Contributor Author

bowenliang123 commented Aug 17, 2022

Still some uncertainties in using Ranger's policy marcos with user/group attrs to be clearify and verify. That's reason I have to take more time than I expected.

So far, user attrs work fine in macros with enabled UserStoreEnricher plus force updating UserStore version code in specific Rest API calling. But group attrs dont.

@bowenliang123 bowenliang123 changed the title [DOCS] Add Ranger UserStoreEnricher enable config suggestion in Authz [DOCS] Additional configs for using Marcos in row-level filter in Authz Aug 18, 2022
@bowenliang123
Copy link
Contributor Author

@pan3793 PR #3267 is created for this issue. Please have a check if interested.

@bowenliang123
Copy link
Contributor Author

@Ero98 FYI.

@pan3793
Copy link
Member

pan3793 commented Aug 18, 2022

Thanks @bowenliang123 I'm going to check it ASAP, also cc @zhouyifan279

@pan3793
Copy link
Member

pan3793 commented Aug 18, 2022

BTW, we can bump ranger version from 2.2.0 to 2.3.0, @bowenliang123 would you like to open PR for it?

@bowenliang123 bowenliang123 changed the title [DOCS] Additional configs for using Marcos in row-level filter in Authz [DOCS] Docs for using Marcos in row-level filter in Authz Aug 18, 2022
@yikf
Copy link
Contributor

yikf commented Aug 19, 2022

BTW, we can bump ranger version from 2.2.0 to 2.3.0, @bowenliang123 would you like to open PR for it?

i'm interesed in this, will fill a title

@bowenliang123
Copy link
Contributor Author

BTW, we can bump ranger version from 2.2.0 to 2.3.0, @bowenliang123 would you like to open PR for it?

Sure. But let's have further investigation to see what to improve the docs and key features.

On my side , I still have some uncertainties about policies on group and group attributes.

pan3793 pushed a commit that referenced this issue Aug 22, 2022
### _Why are the changes needed?_

Support macros in Row-filter condition expression, introduced in Ranger 2.3 ([release notes](https://cwiki.apache.org/confluence/display/RANGER/Apache+Ranger+2.3.0+-+Release+Notes)), is an major feature to significantly simplify the row-filter condition expression in practice by replacing explicit condition query by using user/group's attributes.

- [RANGER-3605](https://issues.apache.org/jira/browse/RANGER-3605) : Support macros in row-filter/condition expressions
- [RANGER-3550](https://issues.apache.org/jira/browse/RANGER-3550) : support for using user/tag attributes in row-filter expressions and conditions
Consider user liangtiancheng with attribute born_city = guangzhou, we can define the row filter condition with city='${{USER.born_city}}' with the macro feature.

However, This feature implicit relies on an config named `ranger.plugin.spark.enable.implicit.userstore.enricher` and the default value false will prevent RangerUserStoreEnricher fetching user/group and their attributes. Macros in row-filter condition will fallback to null value (as lack of user attributes value in UserStore of auth context) in script transformation unexpectedly and imperceptibly.

Improving doc of ranger-spark-security.xml to aware of this feature and related config.

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #3267 from bowenliang123/doc-ranger-macros.

Closes #3217

aee4b20 [liangbowen] plain text
a7ec3bc [liangbowen] update docs and clearify difference between ranger.plugin.hive.policy.cache.dir and ranger.plugin.spark.policy.cache.dir configs
4887bd1 [liangbowen] simplify with "row filter expressions"
fa62402 [liangbowen] skip list items
9dd1cd4 [liangbowen] h5. Using Marcos in Row Level Filters
849bed5 [liangbowen] add docs for Additional configs for using Marcos in row-level filter

Authored-by: liangbowen <liangbowen@gf.com.cn>
Signed-off-by: Kent Yao <yao@apache.org>
pan3793 added a commit that referenced this issue Aug 25, 2022
### _Why are the changes needed?_

Fix #3217 (comment)

This pr aims to bump ranger version from 2.2.0 to 2.3.0

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #3333 from Yikf/pr/3282.

Closes #3333

07b35b9 [Cheng Pan] Update log4j2-test.xml
45a403b [yikf] [KYUUBI #3217][FOLLOWUP] Bump ranger version to 2.3.0

Lead-authored-by: yikf <yikaifei1@gmail.com>
Co-authored-by: Cheng Pan <pan3793@gmail.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:documentation Documentation is a feature!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants