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

[Bug]: [GoSDk] Failed to revoke revoke privilege that granted by the grant_v2 #40275

Open
1 task done
ThreadDao opened this issue Feb 28, 2025 · 4 comments
Open
1 task done
Assignees
Labels
component/gosdk issues & PRs related to GoSDK package kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@ThreadDao
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- Milvus version: master-20250228-762a644d-amd64
- Deployment mode(standalone or cluster): standalone
- MQ type(rocksmq, pulsar or kafka):    
- SDK version(e.g. pymilvus v2.0.0rc2): pymilvus
- OS(Ubuntu or CentOS): 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

  1. Create a role and grant some privileges by `grant_v2'
- GrantItem: <object:Global>, <object_name:*>, <db_name:default>, <role_name:role_OqQtuS>, <grantor_name:root>, <privilege:CollectionAdmin>
  1. try to drop role and it reminds me revoke privilege fitst. ok, But revoke privilege by v1 revoke is not permitted ?
role.drop()
fail to drop the role that it has privileges. Use REVOKE API to revoke privileges

role.revoke("Global", "*", "CollectionAdmin", "default")
can not operate the built-in privilege group [CollectionAdmin])

By the way, used revoke_v2() to revoke privilege granted by v1 grant() successfully

Expected Behavior

No response

Steps To Reproduce

Milvus Log

pod:
zong-debug-milvus-standalone-764bc69867-lvb7w

Anything else?

No response

@ThreadDao ThreadDao added kind/bug Issues or changes related a bug needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 28, 2025
@ThreadDao ThreadDao added this to the 2.5.6 milestone Feb 28, 2025
Copy link

dosubot bot commented Feb 28, 2025

The issue you're encountering seems to be related to the compatibility between the grant_v2 and revoke methods in the Milvus Go SDK. Specifically, it appears that privileges granted using grant_v2 cannot be revoked using the revoke method, which is likely due to differences in how these methods handle privilege groups or specific privilege attributes.

Here are some key points to consider:

  1. Error Message: The error message you received indicates that the revoke method cannot operate on the built-in privilege group CollectionAdmin. This suggests that there might be a limitation or a specific requirement when using revoke to handle privileges granted by grant_v2.

  2. RevokeV2 Method: Since you mentioned that using revoke_v2() successfully revokes privileges granted by grant(), it might be necessary to use revoke_v2() consistently for privileges granted with grant_v2. This could be due to differences in how these methods manage privilege hierarchies or metadata.

  3. Compatibility: It seems there might be a compatibility issue between the grant_v2 and revoke methods. If revoke_v2() works for both grant() and grant_v2, it might be advisable to use revoke_v2() for revoking privileges in your current setup.

To resolve this, you should use the revoke_v2() method to revoke privileges that were granted using grant_v2. This approach should align with the behavior you've observed and avoid the error related to built-in privilege groups.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot dosubot bot added the component/gosdk issues & PRs related to GoSDK package label Feb 28, 2025
@xiaofan-luan
Copy link
Collaborator

Is there an existing issue for this?

  • I have searched the existing issues

Environment

  • Milvus version: master-20250228-762a644d-amd64
  • Deployment mode(standalone or cluster): standalone
  • MQ type(rocksmq, pulsar or kafka):
  • SDK version(e.g. pymilvus v2.0.0rc2): pymilvus
  • OS(Ubuntu or CentOS):
  • CPU/Memory:
  • GPU:
  • Others:

Current Behavior

  1. Create a role and grant some privileges by `grant_v2'
- GrantItem: <object:Global>, <object_name:*>, <db_name:default>, <role_name:role_OqQtuS>, <grantor_name:root>, <privilege:CollectionAdmin>
  1. try to drop role and it reminds me revoke privilege fitst. ok, But revoke privilege by v1 revoke is not permitted ?
role.drop()
fail to drop the role that it has privileges. Use REVOKE API to revoke privileges

role.revoke("Global", "*", "CollectionAdmin", "default")
can not operate the built-in privilege group [CollectionAdmin])

By the way, used revoke_v2() to revoke privilege granted by v1 grant() successfully

Expected Behavior

No response

Steps To Reproduce

Milvus Log

pod: zong-debug-milvus-standalone-764bc69867-lvb7w

Anything else?

No response

I don't think you can grant with V2 and revoke with V1?

V2 has backward compatibility but you can't revoke with v1

@yanliang567 yanliang567 added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 4, 2025
@yanliang567 yanliang567 removed their assignment Mar 4, 2025
@shaoting-huang
Copy link
Contributor

There is no privilege group idea in v1. Therefore, you can only use V2 to revoke privileges granted with V1. But can not use V1 to revoke privileges granted with V2.

@ThreadDao
Copy link
Contributor Author

@shaoting-huang @xiaofan-luan I see. But the error message is not very instructive. Maybe you can suggest using the revoke_v2 api?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/gosdk issues & PRs related to GoSDK package kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

4 participants