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]: [privilege_group] List alias is not forbidden when login with the user added in the role granted with the built-in privilege group "ClusterReadOnly"/"ClusterReadWrite"/"ClusterAdmin" #38052

Open
1 task done
binbinlv opened this issue Nov 27, 2024 · 5 comments
Assignees
Labels
kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@binbinlv
Copy link
Contributor

binbinlv commented Nov 27, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Environment

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

Current Behavior

List alias is not forbidden when login with the user added in the role granted with the built-in privilege group "ClusterReadOnly"/"ClusterReadWrite"/"ClusterAdmin"

Expected Behavior

List alias is forbidden when login with the user added in the role granted with the built-in privilege group "ClusterReadOnly"/"ClusterReadWrite"/"ClusterAdmin"

Steps To Reproduce

from pymilvus import connections
from pymilvus import CollectionSchema, FieldSchema
from pymilvus import Collection
from pymilvus import connections
from pymilvus import DataType
from pymilvus import Partition
from pymilvus import utility
from pymilvus import MilvusClient
from pymilvus import Role

connections.connect(host="***", user="root", password="Milvus")
client = MilvusClient(uri="http://***:19530", user="root", password="Milvus")
client.create_collection("binbin_new", dimension=128)
role = Role("binbin")
role.create()
utility.list_roles(True)
utility.create_user(user="user1", password="Milvus")
role.add_user("user1")
utility.list_roles(True)
role.list_grants()
role.grant_v2("ClusterReadOnly", "*", "*")
utility.create_alias("binbin_new", "binbin_new_alias")
res = utility.list_aliases("binbin_new")
print(res)
connections.connect(host="***", user="user1", password="Milvus")
res = utility.list_aliases("binbin_new")
print(res)

Milvus Log

No response

Anything else?

No response

@binbinlv binbinlv 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 Nov 27, 2024
@binbinlv binbinlv added this to the 2.5.0 milestone Nov 27, 2024
@binbinlv binbinlv 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 Nov 27, 2024
@binbinlv
Copy link
Contributor Author

And the followings in red "N" do not work as expected:

img_v3_02h1_4f99794b-8131-4a75-bf38-890cbc25a1eg

@binbinlv
Copy link
Contributor Author

/assign @shaoting-huang

@sre-ci-robot
Copy link
Contributor

@binbinlv: GitHub didn't allow me to assign the following users: shaoting-huang.

Note that only milvus-io members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @shaoting-huang

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@shaoting-huang
Copy link
Contributor

/assign

@shaoting-huang
Copy link
Contributor

shaoting-huang commented Nov 29, 2024

legacy issue for rbac v1: For the following privielges:
PrivilegeIndexDetail, PrivilegeListAliases, PrivilegeDescribeCollection, PrivilegeDescribeAlias
Proxy does not check and users can operate even if the privilege is not granted

>>> role.add_user("user1")
>>> utility.list_roles(True)
RoleInfo groups:
- RoleItem: <role_name:admin>, <users:()>
- RoleItem: <role_name:binbin>, <users:('user1',)>
- RoleItem: <role_name:public>, <users:()>
>>> role.list_grants()
GrantInfo groups:
>>> 
>>> connections.disconnect('default')
>>> connections.connect(host="localhost", user="user1", password="Milvus")
>>> res = utility.list_aliases("binbin_new")
>>> print(res)
['binbin_new_alias']
>>> c = Collection("binbin_new")
>>> c.describe()
{'collection_name': 'binbin_new', 'auto_id': False, 'num_shards': 1, 'description': '', 'fields': [{'field_id': 100, 'name': 'id', 'description': '', 'type': <DataType.INT64: 5>, 'params': {}, 'is_primary': True}, {'field_id': 101, 'name': 'vector', 'description': '', 'type': <DataType.FLOAT_VECTOR: 101>, 'params': {'dim': 128}}], 'functions': [], 'aliases': ['binbin_new_alias'], 'collection_id': 454260650254009144, 'consistency_level': 2, 'properties': {}, 'num_partitions': 1, 'enable_dynamic_field': True}
>>> c.index
<bound method Collection.index of <Collection>:
-------------
<name>: binbin_new
<description>: 
<schema>: {'auto_id': False, 'description': '', 'fields': [{'name': 'id', 'description': '', 'type': <DataType.INT64: 5>, 'is_primary': True, 'auto_id': False}, {'name': 'vector', 'description': '', 'type': <DataType.FLOAT_VECTOR: 101>, 'params': {'dim': 128}}], 'enable_dynamic_field': True}
>
>>> c.indexes
[<pymilvus.orm.index.Index object at 0x745335754f10>]
>>> c.describe()
{'collection_name': 'binbin_new', 'auto_id': False, 'num_shards': 1, 'description': '', 'fields': [{'field_id': 100, 'name': 'id', 'description': '', 'type': <DataType.INT64: 5>, 'params': {}, 'is_primary': True}, {'field_id': 101, 'name': 'vector', 'description': '', 'type': <DataType.FLOAT_VECTOR: 101>, 'params': {'dim': 128}}], 'functions': [], 'aliases': ['binbin_new_alias'], 'collection_id': 454260650254009144, 'consistency_level': 2, 'properties': {}, 'num_partitions': 1, 'enable_dynamic_field': True}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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