fix(credentials): a token's expiry from the user it belongs to (NetOrk/netork#2728)

GET /access/users/{userid}/token/{tokenid} checks userid-param self, which a
token's request (user@realm!tokenid) never matches, so a token could not read
itself without User.Modify. GET /access/users/{userid} needs Sys.Audit on
/access/groups (PVEAuditor) and returns the user's expire and every token's.
One call now serves both logins; a 403 names the privilege.
This commit is contained in:
Christian Manivong committed 2026-11-26 23:08:47 +01:00
1 parent 707b24748b
commit 87aca53ec2
3 files changed
+118 -70

No files matched your search

+10
View File
@@ -18,6 +18,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Needs napalm-device-types 4.47.0 or later (`AptHistoryMixin`).
### Fixed
- `get_credential_expiry()` reads an API token's expiry from `GET /access/users/{userid}`
(`tokens[tokenid].expire`), in the same one call as the account's (NetOrk/netork#2728).
`GET /access/users/{userid}/token/{tokenid}` refused practically every token: a token's
request runs as `user@realm!tokenid`, which that endpoint's `userid-param self` check
never matches, and its alternative is `User.Modify`. `read_user` needs `Sys.Audit` on
`/access/groups` or a group of the user, which PVEAuditor on `/` gives; a 403 raises a
`PermissionError` that names it. A token without an expiry of its own expires with its
user, and one with its own stops working with its user too: the earlier counts.
## [0.16.0] - 2026-11-26
### Added