-
Notifications
You must be signed in to change notification settings - Fork 600
[#7545] feat(authz): Support fileset authorization #7581
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
[#7545] feat(authz): Support fileset authorization #7581
Conversation
+ "|| SCHEMA::WRITE_FILESET || FILESET::WRITE_FILESET " | ||
+ "|| METALAKE::OWNERSHIP || CATALOG::OWNERSHIP " | ||
+ "|| SCHEMA::OWNERSHIP || FILESET::OWNERSHIP", | ||
accessMetadataType = MetadataObject.Type.FILESET) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OWNER
idents = | ||
MetadataFilterHelper.filterByExpression( | ||
metalake, | ||
"METALAKE::READ_FILESET || CATALOG::READ_FILESET " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
USE_CATALOG and USE_SCHEMA is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)
Please refer to https://github.com/apache/gravitino/pull/7577/files
idents = | ||
MetadataFilterHelper.filterByExpression( | ||
metalake, | ||
"METALAKE::READ_FILESET || CATALOG::READ_FILESET " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)
Please refer to https://github.com/apache/gravitino/pull/7577/files
@AuthorizationExpression( | ||
expression = | ||
"METALAKE::READ_FILESET || CATALOG::READ_FILESET " | ||
+ "|| SCHEMA::READ_FILESET || FILESET::READ_FILESET " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)
Please refer to https://github.com/apache/gravitino/pull/7577/files
@@ -308,6 +345,15 @@ public Response dropFileset( | |||
@Produces("application/vnd.gravitino.v1+json") | |||
@Timed(name = "get-file-location." + MetricNames.HTTP_PROCESS_DURATION, absolute = true) | |||
@ResponseMetered(name = "get-file-location", absolute = true) | |||
@AuthorizationExpression( | |||
expression = | |||
"METALAKE::READ_FILESET || CATALOG::READ_FILESET " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use any expression like ANY(SELECT_TABLE,METALAKE,CATALOG,SCHEMA,TABLE)
Please refer to https://github.com/apache/gravitino/pull/7577/files
9150f56
to
a9148fa
Compare
Map<String, String> properties = Maps.newHashMap(); | ||
properties.put("metastore.uris", hmsUri); | ||
properties.put("location", defaultBaseLocation()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"fileset" is not using the Hive catalog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pleace add ut for authorization expression refer to org.apache.gravitino.server.web.rest.authorization.TestTableAuthorizationExpression
"ANY(OWNER, METALAKE, CATALOG, SCHEMA, FILESET) ||" | ||
+ "(" | ||
+ " ANY(USE_CATALOG, METALAKE, CATALOG) && " | ||
+ " ANY(USE_SCHEMA, METALAKE, CATALOG, SCHEMA) && " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ANY(USE_SCHEMA, METALAKE, CATALOG, SCHEMA) replace to ANY_USE_SCHEMA
ANY(USE_CATALOG, METALAKE, CATALOG) replace to ANY_USE_CATALOG
"ANY(OWNER, METALAKE, CATALOG, SCHEMA, FILESET) ||" | ||
+ "(" | ||
+ " ANY(USE_CATALOG, METALAKE, CATALOG, SCHEMA) && " | ||
+ " ( ANY(READ_FILESET, METALAKE, CATALOG, SCHEMA, FILESET) || ANY(WRITE_FILESET, METALAKE, CATALOG, SCHEMA, FILESET))" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a ANY_WRITE_FILESET in org.apache.gravitino.server.authorization.expression.AuthorizationExpressionConverter such as ANY_USE_CATALOG
+ "|| METALAKE::OWNER || CATALOG::OWNER " | ||
+ "|| SCHEMA::OWNER || FILESET::OWNER", | ||
"ANY(WRITE_FILESET, METALAKE, CATALOG, SCHEMA, FILESET) || " | ||
+ "ANY(OWNER, METALAKE, CATALOG, SCHEMA, FILESET)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FILESET OWNER need USE_SCHEMA and USE_CATALOG
SCHEMA OWNER need USE_CATALOG
@@ -330,15 +337,16 @@ public Response alterFileset( | |||
@Timed(name = "drop-fileset." + MetricNames.HTTP_PROCESS_DURATION, absolute = true) | |||
@ResponseMetered(name = "drop-fileset", absolute = true) | |||
@AuthorizationExpression( | |||
expression = "METALAKE::OWNER || CATALOG::OWNER " + "|| SCHEMA::OWNER || FILESET::OWNER", | |||
expression = "ANY(OWNER, METALAKE, CATALOG, SCHEMA, FILESET)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FILESET OWNER need USE_SCHEMA and USE_CATALOG
SCHEMA OWNER need USE_CATALOG
+ "|| SCHEMA::WRITE_FILESET || FILESET::WRITE_FILESET " | ||
+ "|| METALAKE::OWNER || CATALOG::OWNER " | ||
+ "|| SCHEMA::OWNER || FILESET::OWNER", | ||
"ANY(OWNER, METALAKE, CATALOG, SCHEMA, FILESET) ||" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FILESET OWNER need USE_SCHEMA and USE_CATALOG
SCHEMA OWNER need USE_CATALOG
f00d3f7
to
545aac9
Compare
…at-fileset-auth # Conflicts: # server-common/src/main/java/org/apache/gravitino/server/authorization/MetadataFilterHelper.java # server/src/main/java/org/apache/gravitino/server/web/filter/GravitinoInterceptionService.java
All comments fixed, PHAL @jerqi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, wait for CI.
…at-fileset-auth # Conflicts: # server-common/src/main/java/org/apache/gravitino/server/authorization/MetadataFilterHelper.java # server-common/src/main/java/org/apache/gravitino/server/authorization/expression/AuthorizationExpressionConverter.java # server/src/main/java/org/apache/gravitino/server/web/filter/GravitinoInterceptionService.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
hi @unknowntpo Thank you for your contributions.
<!-- 1. Title: [#<issue>] <type>(<scope>): <subject> Examples: - "[apache#123] feat(operator): support xxx" - "[apache#233] fix: check null before access result in xxx" - "[MINOR] refactor: fix typo in variable name" - "[MINOR] docs: fix typo in README" - "[apache#255] test: fix flaky test NameOfTheTest" Reference: https://www.conventionalcommits.org/en/v1.0.0/ 2. If the PR is unfinished, please mark this PR as draft. --> ### What changes were proposed in this pull request? Support fileset auth with annotation. ### Why are the changes needed? To support fileset auth. Fix: apache#7545 ### Does this PR introduce _any_ user-facing change? Yes. ### How was this patch tested? FilesetAuthorizationIT --------- Co-authored-by: yangyang zhong <35210666+hdygxsj@users.noreply.github.com> Co-authored-by: 1161623489@qq.com <1161623489@qq.com>
<!-- 1. Title: [#<issue>] <type>(<scope>): <subject> Examples: - "[apache#123] feat(operator): support xxx" - "[apache#233] fix: check null before access result in xxx" - "[MINOR] refactor: fix typo in variable name" - "[MINOR] docs: fix typo in README" - "[apache#255] test: fix flaky test NameOfTheTest" Reference: https://www.conventionalcommits.org/en/v1.0.0/ 2. If the PR is unfinished, please mark this PR as draft. --> ### What changes were proposed in this pull request? Support fileset auth with annotation. ### Why are the changes needed? To support fileset auth. Fix: apache#7545 ### Does this PR introduce _any_ user-facing change? Yes. ### How was this patch tested? FilesetAuthorizationIT --------- Co-authored-by: yangyang zhong <35210666+hdygxsj@users.noreply.github.com> Co-authored-by: 1161623489@qq.com <1161623489@qq.com>
<!-- 1. Title: [#<issue>] <type>(<scope>): <subject> Examples: - "[apache#123] feat(operator): support xxx" - "[apache#233] fix: check null before access result in xxx" - "[MINOR] refactor: fix typo in variable name" - "[MINOR] docs: fix typo in README" - "[apache#255] test: fix flaky test NameOfTheTest" Reference: https://www.conventionalcommits.org/en/v1.0.0/ 2. If the PR is unfinished, please mark this PR as draft. --> ### What changes were proposed in this pull request? Support fileset auth with annotation. ### Why are the changes needed? To support fileset auth. Fix: apache#7545 ### Does this PR introduce _any_ user-facing change? Yes. ### How was this patch tested? FilesetAuthorizationIT --------- Co-authored-by: yangyang zhong <35210666+hdygxsj@users.noreply.github.com> Co-authored-by: 1161623489@qq.com <1161623489@qq.com>
<!-- 1. Title: [#<issue>] <type>(<scope>): <subject> Examples: - "[#123] feat(operator): support xxx" - "[#233] fix: check null before access result in xxx" - "[MINOR] refactor: fix typo in variable name" - "[MINOR] docs: fix typo in README" - "[#255] test: fix flaky test NameOfTheTest" Reference: https://www.conventionalcommits.org/en/v1.0.0/ 2. If the PR is unfinished, please mark this PR as draft. --> ### What changes were proposed in this pull request? Support fileset auth with annotation. ### Why are the changes needed? To support fileset auth. Fix: #7545 ### Does this PR introduce _any_ user-facing change? Yes. ### How was this patch tested? FilesetAuthorizationIT --------- Co-authored-by: yangyang zhong <35210666+hdygxsj@users.noreply.github.com> Co-authored-by: 1161623489@qq.com <1161623489@qq.com>
<!-- 1. Title: [#<issue>] <type>(<scope>): <subject> Examples: - "[apache#123] feat(operator): support xxx" - "[apache#233] fix: check null before access result in xxx" - "[MINOR] refactor: fix typo in variable name" - "[MINOR] docs: fix typo in README" - "[apache#255] test: fix flaky test NameOfTheTest" Reference: https://www.conventionalcommits.org/en/v1.0.0/ 2. If the PR is unfinished, please mark this PR as draft. --> ### What changes were proposed in this pull request? Support fileset auth with annotation. ### Why are the changes needed? To support fileset auth. Fix: apache#7545 ### Does this PR introduce _any_ user-facing change? Yes. ### How was this patch tested? FilesetAuthorizationIT --------- Co-authored-by: yangyang zhong <35210666+hdygxsj@users.noreply.github.com> Co-authored-by: 1161623489@qq.com <1161623489@qq.com>
What changes were proposed in this pull request?
Support fileset auth with annotation.
Why are the changes needed?
To support fileset auth.
Fix: #7545
Does this PR introduce any user-facing change?
Yes.
How was this patch tested?
FilesetAuthorizationIT