Skip to content

feat: RBAC support (Sync/Async) #349

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

Merged
merged 40 commits into from
Feb 27, 2025
Merged

feat: RBAC support (Sync/Async) #349

merged 40 commits into from
Feb 27, 2025

Conversation

bevzzz
Copy link
Collaborator

@bevzzz bevzzz commented Jan 24, 2025

Related to #343.

This PR is the first iteration of that story, adding RBAC support to the sync client.
Initially it drew a lot on the Python's client, but I ended up re-organizing things to be consistent with the current client.

  • Adds support for RBAC endpoints via client.async().roles()
  • Unified integration test suite for sync and async clients -- would love to hear your opinion on that.

Files to pay attention to (have denser logic):

Permission.java
WeaviatePermission.java
Role.java
WeaviateRole.java
ClientRbacTestSuite.java

Copy link

@orca-security-eu orca-security-eu bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@bevzzz bevzzz linked an issue Jan 24, 2025 that may be closed by this pull request
@bevzzz bevzzz changed the title Feature/rbac async RBAC for AsyncClient Jan 24, 2025
@bevzzz bevzzz changed the title RBAC for AsyncClient RBAC Support (Sync/Async) Jan 30, 2025
@bevzzz bevzzz changed the title RBAC Support (Sync/Async) RBAC support Jan 30, 2025
@bevzzz bevzzz changed the title RBAC support feat: RBAC support (Sync/Async) Jan 30, 2025
@EqualsAndHashCode makes comparing Role and Permission objects easy
Makes creating several permissions for the same resource easier.
For example, instead of 'Permission.data('Pizza', CREATE), Permission.data('Pizza', DELETE)'
users can write 'Permission.data('Pizza', CREATE, DELETE)'.

To avoid having ~4 different withPermission() builder methods in the client classes
all factory methods on Permission class will return Permission[] (even if known to be length 1).
Moved to a separate file and documented.
bevzzz and others added 13 commits February 26, 2025 13:13
- rename manage_users -> assign_and_revoke_users
- add read_users action
- add [crud]_roles actions
- add scope for roles actions
- default to VERBOSE verbosity for nodes permission if collection filter applied
Separate RBAC- and User-related tests
Upgrage Weaviate server version to v1.28.6
Update test cases to reflect new server defaults in 1.28.6
Some actions are hard-deprecated and will result in an error.
They are only used by the library internally to read legacy permissions.
Java 8 does not have Stream::toList.
@bevzzz bevzzz force-pushed the feature/rbac-async branch from dca4abd to 1d80eb5 Compare February 26, 2025 12:16
 Permission holds all actions it permits and is distinguished from other
 permissions by its resource filters.

 Permissions are "flattened" before being sent to Weaviate and then
 grouped / merged back together after the response's been deserialized.
This lets us skip deduplication in merge()
@bevzzz bevzzz requested a review from antas-marcin February 27, 2025 12:49
@bevzzz bevzzz merged commit 07e51f6 into main Feb 27, 2025
5 checks passed
@bevzzz bevzzz deleted the feature/rbac-async branch February 27, 2025 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for RBAC
2 participants