Repository navigation
Conversation
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
There was a problem hiding this comment.
🟢 Approval recommended
The API key expiration changes have no active review issues.
No open issues 🎉
What changed in this PR
Adds API key expiration management to the Python client’s DB user APIs for licensed Weaviate 1.41+ servers.
Changes:
- Supports expiration during user creation and setting or removing expiration for existing users.
- Exposes expiration timestamps in user responses and updates synchronous and asynchronous type signatures.
- Adds integration coverage and configures CI to test against Weaviate 1.41 with optional license credentials.
| File | Description |
|---|---|
weaviate/util.py |
Adds the Weaviate 1.41 version guard. |
weaviate/users/users.py |
Adds expiration fields to user models. |
weaviate/users/sync.pyi |
Updates synchronous API signatures for expiration support. |
weaviate/users/base.py |
Implements expiration requests, response parsing, and related documentation. |
weaviate/users/async_.pyi |
Updates asynchronous API signatures for expiration support. |
weaviate/rbac/models.py |
Types the expiration field in DB user responses. |
integration/test_users.py |
Tests expiration management, key rotation, and unsupported versions. |
ci/docker-compose-rbac.yml |
Passes the optional license key to the RBAC server. |
.github/workflows/main.yaml |
Adds Weaviate 1.41 to integration testing and supplies license credentials. |
Review effort: Balanced
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev/1.41 #2249 +/- ##
===========================================
Coverage ? 92.19%
===========================================
Files ? 311
Lines ? 23738
Branches ? 0
===========================================
Hits ? 21886
Misses ? 1852
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Secrets | View in Orca |
|
|
||
| Args: | ||
| user_id: The id of the new user. | ||
| expires_at: The time at which the user's API key stops authenticating, which must be in the future. Weaviate stores it in UTC to the millisecond. If None, the key never expires. Requires Weaviate 1.41+ and a Weaviate license key on the server. |
There was a problem hiding this comment.
The "expires_at" essentially relates to the user as it carries over when the key rotates. So I wonder if we should phrase all the docstrings around the db user: e.g.:
expires_at: The future time at which the db user can no longer authenticate. Weaviate stores it in UTC to the millisecond. If None, the key never expires...
| created_at: Optional[datetime] = field(default=None) | ||
| last_used_time: Optional[datetime] = field(default=None) | ||
| api_key_first_letters: Optional[str] = field(default=None) | ||
| expires_at: Optional[datetime] = field(default=None) |
There was a problem hiding this comment.
Active & expired may be confusing. Wdyt about adding a comment to active: bool? Like:
# Administratively enabled; expiration does not change this value.
DB users can now have an API key that expires.
users.db.createtakes an optionalexpires_at, andusers.db.update_expirationchanges it or, givenNone, makes the key never expire.users.db.get,users.db.list_allandusers.get_my_userreturn it asexpires_at.Unless the server holds a Weaviate license key, it answers such a request with 403. An expired user still reports
activeas True, so a caller comparesexpires_atwith the current time.