[Bug] Pool grants no longer show any VMs since 1.1.0 — the inventory gate wants vm.view, which POOL_PERMISSIONS does not allow
Describe the bug
Since 1.1.0, a user whose access to a cluster comes from a resource-pool grant sees the pool in the tree but no VMs inside it. The list comes back empty for every pool grant except pool.admin.
The cause is a contradiction between what a pool grant may contain and what the inventory gate asks for:
-
GET /api/clusters/<id>/resourcesandGET /api/clusters/<id>/vmsnow filter every VM throughuser_can_access_vm(user, cluster_id, vmid, 'vm.view', vm_type)for callers who are not tenant owners of the cluster (pegaprox/api/clusters.py,pegaprox/api/vms.py:288-296). -
In the pool branch of
user_can_access_vm(pegaprox/utils/rbac.py) the match is exact:pool.admingrants everything, otherwise the requested permission string must literally be present in the grant. -
But
POOL_PERMISSIONS(pegaprox/api/users.py:1885) — the allowlist the grant endpoint validates against — does not containvm.view:POOL_PERMISSIONS = [ 'pool.view', 'vm.start', 'vm.stop', 'vm.console', 'vm.config', 'vm.snapshot', 'vm.backup', 'vm.migrate', 'vm.clone', 'vm.delete', 'pool.admin', ]
So vm.view can never be stored in a pool grant — the endpoint rejects it with 400 Invalid permissions — while the inventory gate accepts nothing else. pool.admin is the only value in the whole allowlist that produces visibility.
The three quick-select presets in the UI (web/src/settings_modal.js:4471, 4481, 4491) make this concrete:
| Preset | Permissions granted | VMs visible |
|---|---|---|
| Operator | pool.view, vm.start, vm.stop, vm.console |
no |
| Power User | + vm.config, vm.snapshot, vm.backup |
no |
| Admin | pool.admin |
yes |
The practical effect is that an admin who wants to give a team read access and a console to one pool has to grant pool.admin instead, which short-circuits the per-VM gate for every permission including vm.delete — described in your own comment as "the strongest grant primitive in the product". The presets that exist to grant less are the ones that do not work.
This is a regression from 1.1.0, introduced by 6441b70 ("security(authz): confine pool/ACL-reach on VM inventory"). That change itself is right — before it, a pool-scoped caller got the blanket role-level vm.view fallback and could read the entire cluster inventory, not just their pool. Closing that hole exposed the mismatch, which had been latent all along.
tests/test_authz_pool.py passes because its fixture seeds ['pool.view', 'vm.view'] straight into the DB, bypassing the API validation — so the regression suite asserts a state that cannot be reached through the product.
Steps to Reproduce
- As an admin, create a resource pool in a cluster and put a few VMs in it.
- Take a user whose tenant does not own that cluster (so their only route to it is the pool grant).
- Settings → Permissions → Pool Permissions → grant that user the pool with the Power User preset.
- Log in as that user and open the cluster: the pool is listed, but it contains no VMs.
GET /api/clusters/<id>/resourcesreturns200with an empty array. - Re-grant with the Admin preset (
pool.admin) and the VMs appear.
Trying to add vm.view to the grant instead is rejected: PUT of a permission set containing vm.view returns 400 Invalid permissions: ['vm.view'].
Expected behavior
A pool grant that confers actions on a pool's VMs should also let the user see those VMs. Granting vm.start and vm.console on a pool but no visibility is not a usable state — the user holds permissions on objects the API will not list.
Two ways to resolve it, your call which fits the model better:
- In the pool branch, treat a pool grant as conferring
vm.view. You already use exactly this rule for the client portal (pegaprox/utils/rbac.py, the pool-listing helper: "so the portal list shows a pool's VMs to anyone with a grant on it" —if permission is None: ok_pools = {pid for pid, perms in user_pool_perms.items() if perms}). Applying it to the inventory gate needs no migration and repairs grants already in the field. - Add
vm.viewtoPOOL_PERMISSIONSand to the presets. More explicit, but grants created before the change stay broken until they are re-saved, so it likely wants a one-time backfill.
Environment
- PegaProx Version: 1.1.1
- Installation Method: Docker (Docker Swarm)
- OS: Debian 12
- Browser: Chrome 151
- Behind Reverse Proxy? nginx-proxy
- UI? Corporate
Checklist
- [x] I have searched existing issues to make sure this is not a duplicate
- [x] I am using the latest version of PegaProx
Confirmed all of it, and fixed on Testing. You saved us the whole investigation — the POOL_PERMISSIONS vs vm.view mismatch is exactly it.
Went with your first option: a non-empty grant on a pool now confers visibility of that pool's members, actions still need the exact permission. No migration, grants already out there start working again as they are. The bit that stung was your last point — the pool test seeds vm.view straight into the DB, so the suite was asserting a state the API would reject. New tests grant through the real endpoint with the three presets verbatim, plus one that checks every preset the UI offers is something the endpoint would actually accept.
Nothing you need to do on your side except update once it is out. Thanks for writing it up that carefully.
https://opencollective.com/pegaprox if you want to throw something in the hat.
Cheers, Marcus
Fixed in 1.2.0. A pool grant makes the pool's VMs visible again — the inventory gate was checking the wrong thing since 1.1.0, which is why it looked like the grants had stopped working.
Marcus