Skip to content

Commit bb32213

Browse files
fix(dashboard): grant tenant dashboard read on cozy-public PVCs
The vm-disk source image dropdown in the console lists PersistentVolumeClaims in cozy-public (the vm-default-images-* golden images). The browser issues that list as the tenant identity (e.g. system:serviceaccount:tenant-root:tenant-root), but the cozy:tenant:dashboard Role only granted read on Flux helmrepositories and helmcharts. The list returned 403 and the dropdown stayed empty even when the images existed. Add get/list/watch on persistentvolumeclaims to the Role. cozy-public is a shared public namespace, so read on its PVCs is safe to expose to every tenant dashboard subject. A helm-unittest regression pins the grant. Assisted-By: Claude <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 26574f0 commit bb32213

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

‎packages/system/cozystack-basics/templates/dashboard-role.yaml‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
# == dashboard role ==
3-
# Single namespaced role for tenant dashboard access to helm resources
3+
# Single namespaced role for tenant dashboard access to shared cozy-public resources
44
apiVersion: rbac.authorization.k8s.io/v1
55
kind: Role
66
metadata:
@@ -13,3 +13,11 @@ rules:
1313
- apiGroups: ["source.toolkit.fluxcd.io"]
1414
resources: ["helmcharts"]
1515
verbs: ["get", "list"]
16+
# The console lists PVCs in cozy-public (the vm-default-images-* golden images)
17+
# to populate the source image dropdown when creating a vm-disk. The browser
18+
# issues this list as the tenant identity, so without a read grant here it gets
19+
# 403 and the dropdown is empty. cozy-public is a shared public namespace, so
20+
# read on its PVCs is safe to expose to every tenant dashboard subject.
21+
- apiGroups: [""]
22+
resources: ["persistentvolumeclaims"]
23+
verbs: ["get", "list", "watch"]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
suite: cozystack-basics tenant dashboard Role grants read on cozy-public resources
2+
3+
templates:
4+
- templates/dashboard-role.yaml
5+
6+
release:
7+
name: cozystack-basics
8+
namespace: cozy-system
9+
10+
# The vm-disk source image dropdown lists PersistentVolumeClaims in cozy-public
11+
# (the vm-default-images-* golden images). The console issues that list as the
12+
# tenant identity (e.g. the tenant-root ServiceAccount), so the cozy:tenant:dashboard
13+
# Role must grant read on PVCs; otherwise the browser gets 403 and the dropdown
14+
# is empty even though the images exist.
15+
tests:
16+
- it: cozy:tenant:dashboard grants read on persistentvolumeclaims in cozy-public
17+
documentSelector:
18+
path: metadata.name
19+
value: cozy:tenant:dashboard
20+
asserts:
21+
- equal:
22+
path: metadata.namespace
23+
value: cozy-public
24+
- contains:
25+
path: rules
26+
content:
27+
apiGroups: [""]
28+
resources: ["persistentvolumeclaims"]
29+
verbs: ["get", "list", "watch"]

0 commit comments

Comments
 (0)