You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "jerqi (via GitHub)" <gi...@apache.org> on 2026/01/12 13:09:25 UTC
[PR] [#9616] fix(authz): Fix the `PassThroughAuthorizer` user verification logic [gravitino]
jerqi opened a new pull request, #9691:
URL: https://github.com/apache/gravitino/pull/9691
### What changes were proposed in this pull request?
Fix the `PassThroughAuthorizer` user verification logic
### Why are the changes needed?
Fix: #9616
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Added IT.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9616] fix(authz): Fix the `PassThroughAuthorizer` user verification logic [gravitino]
Posted by "hdygxsj (via GitHub)" <gi...@apache.org>.
hdygxsj commented on code in PR #9691:
URL: https://github.com/apache/gravitino/pull/9691#discussion_r2685411857
##########
server-common/src/main/java/org/apache/gravitino/server/authorization/PassThroughAuthorizer.java:
##########
@@ -76,6 +80,14 @@ public boolean isSelf(Entity.EntityType type, NameIdentifier nameIdentifier) {
@Override
public boolean isMetalakeUser(String metalake) {
+ AccessControlDispatcher dispatcher = GravitinoEnv.getInstance().accessControlDispatcher();
+ if (dispatcher != null) {
+ try {
+ dispatcher.getUser(metalake, PrincipalUtils.getCurrentUserName());
+ } catch (NoSuchUserException e) {
+ dispatcher.addUser(metalake, PrincipalUtils.getCurrentUserName());
Review Comment:
If authentication and authorization are not enabled. This method won't be called. ——— If authorization isn't enabled, doesn't it just use the PassThroughAuthorizer?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9616] fix(authz): Fix the `PassThroughAuthorizer` user verification logic [gravitino]
Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #9691:
URL: https://github.com/apache/gravitino/pull/9691#discussion_r2685400616
##########
server-common/src/main/java/org/apache/gravitino/server/authorization/PassThroughAuthorizer.java:
##########
@@ -76,6 +80,14 @@ public boolean isSelf(Entity.EntityType type, NameIdentifier nameIdentifier) {
@Override
public boolean isMetalakeUser(String metalake) {
+ AccessControlDispatcher dispatcher = GravitinoEnv.getInstance().accessControlDispatcher();
+ if (dispatcher != null) {
+ try {
+ dispatcher.getUser(metalake, PrincipalUtils.getCurrentUserName());
+ } catch (NoSuchUserException e) {
+ dispatcher.addUser(metalake, PrincipalUtils.getCurrentUserName());
Review Comment:
It will throw forbidden exceptions which user doesn't exist in the metalake.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9616] fix(authz): Fix the `PassThroughAuthorizer` user verification logic [gravitino]
Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #9691:
URL: https://github.com/apache/gravitino/pull/9691#discussion_r2685400616
##########
server-common/src/main/java/org/apache/gravitino/server/authorization/PassThroughAuthorizer.java:
##########
@@ -76,6 +80,14 @@ public boolean isSelf(Entity.EntityType type, NameIdentifier nameIdentifier) {
@Override
public boolean isMetalakeUser(String metalake) {
+ AccessControlDispatcher dispatcher = GravitinoEnv.getInstance().accessControlDispatcher();
+ if (dispatcher != null) {
+ try {
+ dispatcher.getUser(metalake, PrincipalUtils.getCurrentUserName());
+ } catch (NoSuchUserException e) {
+ dispatcher.addUser(metalake, PrincipalUtils.getCurrentUserName());
Review Comment:
It will throw forbidden exceptions which user doesn't exist in the metalake. If authentication and authorization are not enabled. This method won't be called.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9616] fix(authz): Fix the `PassThroughAuthorizer` user verification logic [gravitino]
Posted by "hdygxsj (via GitHub)" <gi...@apache.org>.
hdygxsj commented on code in PR #9691:
URL: https://github.com/apache/gravitino/pull/9691#discussion_r2685139618
##########
docs/security/access-control.md:
##########
@@ -455,6 +455,73 @@ gravitino.authorization.enable = true
gravitino.authorization.serviceAdmins = admin1,admin2
```
+## Migration Guide
+
+If you have metalakes that were created before authorization was enabled, you need to perform a migration to ensure proper access control.
Review Comment:
Should the affected versions be added here?
##########
server-common/src/main/java/org/apache/gravitino/server/authorization/PassThroughAuthorizer.java:
##########
@@ -76,6 +80,14 @@ public boolean isSelf(Entity.EntityType type, NameIdentifier nameIdentifier) {
@Override
public boolean isMetalakeUser(String metalake) {
+ AccessControlDispatcher dispatcher = GravitinoEnv.getInstance().accessControlDispatcher();
+ if (dispatcher != null) {
+ try {
+ dispatcher.getUser(metalake, PrincipalUtils.getCurrentUserName());
+ } catch (NoSuchUserException e) {
+ dispatcher.addUser(metalake, PrincipalUtils.getCurrentUserName());
Review Comment:
Why is it necessary to add the user here?
If authentication and authorization are not enabled, could there be any issues here?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9616] fix(authz): Fix the `PassThroughAuthorizer` user verification logic [gravitino]
Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #9691:
URL: https://github.com/apache/gravitino/pull/9691#discussion_r2685619325
##########
server-common/src/main/java/org/apache/gravitino/server/authorization/PassThroughAuthorizer.java:
##########
@@ -76,6 +80,14 @@ public boolean isSelf(Entity.EntityType type, NameIdentifier nameIdentifier) {
@Override
public boolean isMetalakeUser(String metalake) {
+ AccessControlDispatcher dispatcher = GravitinoEnv.getInstance().accessControlDispatcher();
+ if (dispatcher != null) {
+ try {
+ dispatcher.getUser(metalake, PrincipalUtils.getCurrentUserName());
+ } catch (NoSuchUserException e) {
+ dispatcher.addUser(metalake, PrincipalUtils.getCurrentUserName());
Review Comment:
If authorization enable is false, AccessControlDispatcher will be null.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9616] fix(authz): Fix the `PassThroughAuthorizer` user verification logic [gravitino]
Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi merged PR #9691:
URL: https://github.com/apache/gravitino/pull/9691
--
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.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9616] fix(authz): Fix the `PassThroughAuthorizer` user verification logic [gravitino]
Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #9691:
URL: https://github.com/apache/gravitino/pull/9691#discussion_r2685618269
##########
server-common/src/main/java/org/apache/gravitino/server/authorization/PassThroughAuthorizer.java:
##########
@@ -76,6 +80,14 @@ public boolean isSelf(Entity.EntityType type, NameIdentifier nameIdentifier) {
@Override
public boolean isMetalakeUser(String metalake) {
+ AccessControlDispatcher dispatcher = GravitinoEnv.getInstance().accessControlDispatcher();
+ if (dispatcher != null) {
+ try {
+ dispatcher.getUser(metalake, PrincipalUtils.getCurrentUserName());
+ } catch (NoSuchUserException e) {
+ dispatcher.addUser(metalake, PrincipalUtils.getCurrentUserName());
Review Comment:
If authorization enable is false, AccessControlDispatcher will be null.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9616] fix(authz): Fix the `PassThroughAuthorizer` user verification logic [gravitino]
Posted by "hdygxsj (via GitHub)" <gi...@apache.org>.
hdygxsj commented on code in PR #9691:
URL: https://github.com/apache/gravitino/pull/9691#discussion_r2685411857
##########
server-common/src/main/java/org/apache/gravitino/server/authorization/PassThroughAuthorizer.java:
##########
@@ -76,6 +80,14 @@ public boolean isSelf(Entity.EntityType type, NameIdentifier nameIdentifier) {
@Override
public boolean isMetalakeUser(String metalake) {
+ AccessControlDispatcher dispatcher = GravitinoEnv.getInstance().accessControlDispatcher();
+ if (dispatcher != null) {
+ try {
+ dispatcher.getUser(metalake, PrincipalUtils.getCurrentUserName());
+ } catch (NoSuchUserException e) {
+ dispatcher.addUser(metalake, PrincipalUtils.getCurrentUserName());
Review Comment:
If authentication and authorization are not enabled. This method won't be called. ——— If authorization isn't enabled, doesn't it just use the PassThroughAuthorizer?
<img width="967" height="623" alt="image" src="https://github.com/user-attachments/assets/5c6333a4-2c78-4ce8-ba5a-b6f946d57566" />
--
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.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9616] fix(authz): Fix the `PassThroughAuthorizer` user verification logic [gravitino]
Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #9691:
URL: https://github.com/apache/gravitino/pull/9691#discussion_r2685427642
##########
docs/security/access-control.md:
##########
@@ -455,6 +455,73 @@ gravitino.authorization.enable = true
gravitino.authorization.serviceAdmins = admin1,admin2
```
+## Migration Guide
+
+If you have metalakes that were created before authorization was enabled, you need to perform a migration to ensure proper access control.
Review Comment:
Every version should migrate.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#9616] fix(authz): Fix the `PassThroughAuthorizer` user verification logic [gravitino]
Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on code in PR #9691:
URL: https://github.com/apache/gravitino/pull/9691#discussion_r2685619325
##########
server-common/src/main/java/org/apache/gravitino/server/authorization/PassThroughAuthorizer.java:
##########
@@ -76,6 +80,14 @@ public boolean isSelf(Entity.EntityType type, NameIdentifier nameIdentifier) {
@Override
public boolean isMetalakeUser(String metalake) {
+ AccessControlDispatcher dispatcher = GravitinoEnv.getInstance().accessControlDispatcher();
+ if (dispatcher != null) {
+ try {
+ dispatcher.getUser(metalake, PrincipalUtils.getCurrentUserName());
+ } catch (NoSuchUserException e) {
+ dispatcher.addUser(metalake, PrincipalUtils.getCurrentUserName());
Review Comment:
If authorization enable is false, AccessControlDispatcher will be null.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org