You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cost-management): change permission name separator from dot to slash (#2620)
* fix(cost-management): change permission name separator from dot to slash
Cluster-specific and project-specific permissions now use / instead of .
as the separator (e.g. ros/my.cluster/project instead of
ros.my.cluster.project), resolving ambiguity when cluster names contain
dots. Generic permissions (ros.plugin, ros.apply, cost.plugin) are
unchanged. Includes migration guide in docs/rbac.md.
FLPATH-3489
Made-with: Cursor
* fix: return 403 instead of 500 for OpenShift tab when user lacks cost.plugin permission
resolveCostManagementAccess data fetcher did not handle errors from the
upstream cost-management API, causing unhandled exceptions to propagate
as 500 Internal Server Error. The ROS (optimizations) fetcher already
returned null on error, which resolveAccessForSection maps to DENY/403.
Apply the same pattern: wrap token fetch and API calls in try/catch,
check for error responses, and return null so the RBAC flow correctly
returns 403 Forbidden.
Made-with: Cursor
* fix: disable Apply Recommendation button when user lacks ros.apply permission
The button was only disabled when the workflow was unavailable, not when
the user lacked the ros.apply RBAC permission. Added usePermission hook
to check ros.apply on the frontend and disable the button with a tooltip
explaining the lack of permission.
Also surface backend 403 errors via ResponseErrorPanel instead of
silently swallowing them in the catch handler.
Made-with: Cursor
* fix(cost-management): update stale comments to use slash separator format
Update comments in costManagementAccess.ts and checkPermissions.ts that still
referenced the old dot-separator format (cost.{cluster}) to use the new slash
format (cost/{cluster}) matching the actual permission implementation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix(cost-management): update yarn.lock for permission-react dependency
Made-with: Cursor
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
'@red-hat-developer-hub/plugin-cost-management-common': minor
3
+
'@red-hat-developer-hub/plugin-cost-management-backend': minor
4
+
---
5
+
6
+
**BREAKING**: Changed permission name separator from `.` to `/` for cluster-specific and cluster-project-specific permissions.
7
+
8
+
This resolves an ambiguity where dotted cluster names (e.g., `my.cluster`) could not be distinguished from the separator in permission names like `ros.my.cluster.project`.
9
+
10
+
New format:
11
+
12
+
-`ros/{clusterName}` and `ros/{clusterName}/{projectName}` (was `ros.{clusterName}` and `ros.{clusterName}.{projectName}`)
13
+
-`cost/{clusterName}` and `cost/{clusterName}/{projectName}` (was `cost.{clusterName}` and `cost.{clusterName}.{projectName}`)
14
+
15
+
Generic permissions (`ros.plugin`, `ros.apply`, `cost.plugin`) are unchanged.
Copy file name to clipboardExpand all lines: workspaces/cost-management/docs/rbac.md
+66-27Lines changed: 66 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ When a frontend request arrives at `/api/cost-management/proxy/*`, the backend:
16
16
5. Injects the server-authorized filters before forwarding to the upstream API
17
17
6. Returns only the data the user is permitted to see
18
18
19
-
This means granting `ros.demolab` only allows seeing data for the `demolab` cluster — the user cannot modify query parameters to access other clusters.
19
+
This means granting `ros/demolab` only allows seeing data for the `demolab` cluster — the user cannot modify query parameters to access other clusters.
20
20
21
21
### Apply Recommendation authorization
22
22
@@ -38,11 +38,11 @@ The Optimizations section allows users to view resource usage trends and optimiz
| ros.plugin | - | read | Allows the user to access all optimization data in the Cost Management plugin |
41
-
| ros.[CLUSTER_NAME]| - | read | Allows the user to access optimization data for a specific Cluster in the Cost Management plugin |
42
-
| ros.[CLUSTER_NAME].[PROJECT_NAME]| - | read | Allows the user to access optimization data for a specific Project within a specific Cluster in the Cost Management plugin |
41
+
| ros/[CLUSTER_NAME]| - | read | Allows the user to access optimization data for a specific Cluster in the Cost Management plugin |
42
+
| ros/[CLUSTER_NAME]/[PROJECT_NAME]| - | read | Allows the user to access optimization data for a specific Project within a specific Cluster in the Cost Management plugin |
43
43
| ros.apply | - | update | Allows the user to apply optimization recommendations via workflow execution |
44
44
45
-
The user is permitted to do an action if either the generic permission or the specific one allows it. In other words, it is not possible to grant generic ros.plugin and then selectively disable it for a specific cluster via ros.[CLUSTER_NAME] with deny.
45
+
The user is permitted to do an action if either the generic permission or the specific one allows it. In other words, it is not possible to grant generic ros.plugin and then selectively disable it for a specific cluster via ros/[CLUSTER_NAME] with deny.
46
46
47
47
## 2. OpenShift Section
48
48
@@ -53,10 +53,10 @@ The OpenShift section displays cost tracking for OpenShift clusters with flexibl
| cost.plugin | - | read | Allows the user to access all OpenShift cost data in the Cost Management plugin |
56
-
| cost.[CLUSTER_NAME]| - | read | Allows the user to access OpenShift cost data for a specific Cluster in the Cost Management plugin |
57
-
| cost.[CLUSTER_NAME].[PROJECT_NAME]| - | read | Allows the user to access OpenShift cost data for a specific Project within a specific Cluster in the Cost Management plugin |
56
+
| cost/[CLUSTER_NAME]| - | read | Allows the user to access OpenShift cost data for a specific Cluster in the Cost Management plugin |
57
+
| cost/[CLUSTER_NAME]/[PROJECT_NAME]| - | read | Allows the user to access OpenShift cost data for a specific Project within a specific Cluster in the Cost Management plugin |
58
58
59
-
The user is permitted to do an action if either the generic permission or the specific one allows it. In other words, it is not possible to grant generic cost.plugin and then selectively disable it for a specific cluster via cost.[CLUSTER_NAME] with deny.
59
+
The user is permitted to do an action if either the generic permission or the specific one allows it. In other words, it is not possible to grant generic cost.plugin and then selectively disable it for a specific cluster via cost/[CLUSTER_NAME] with deny.
Since the `test_user_2` user has the `default/rosClusterUser` role, which has `ros.OpenShift on AWS` permission, it can:
129
+
Since the `test_user_2` user has the `default/rosClusterUser` role, which has `ros/OpenShift on AWS` permission, it can:
130
130
131
131
- See the list of records for `OpenShift on AWS` cluster for the service account which is specified in the [app-config file](../app-config.yaml) file using `clientId` and `clientSecret` and optimization recommendations for the same.
132
132
133
133
```csv
134
-
p, role:default/rosClusterUser, ros.OpenShift on AWS, read, allow
134
+
p, role:default/rosClusterUser, ros/OpenShift on AWS, read, allow
Since the `test_user_3` user has the `default/rosClusterProjectUser` role, which has `ros.demolab.thanos` permission, it can:
141
+
Since the `test_user_3` user has the `default/rosClusterProjectUser` role, which has `ros/demolab/thanos` permission, it can:
142
142
143
143
- See the list of records for `thanos` project under `demolab` cluster for the service account which is specified in the [app-config file](../app-config.yaml) file using `clientId` and `clientSecret` and optimization recommendations for the same.
Since the `test_user_5` user has the `default/costClusterUser` role, which has `cost.OpenShift on AWS` permission, it can:
181
+
Since the `test_user_5` user has the `default/costClusterUser` role, which has `cost/OpenShift on AWS` permission, it can:
182
182
183
183
- See the list of records for `OpenShift on AWS` cluster for the service account which is specified in the [app-config file](../app-config.yaml) file using `clientId` and `clientSecret` and cost data for the same.
184
184
185
185
```csv
186
-
p, role:default/costClusterUser, cost.OpenShift on AWS, read, allow
186
+
p, role:default/costClusterUser, cost/OpenShift on AWS, read, allow
Since the `test_user_6` user has the `default/costClusterProjectUser` role, which has `cost.demolab.thanos` permission, it can:
193
+
Since the `test_user_6` user has the `default/costClusterProjectUser` role, which has `cost/demolab/thanos` permission, it can:
194
194
195
195
- See the list of records for `thanos` project under `demolab` cluster for the service account which is specified in the [app-config file](../app-config.yaml) file using `clientId` and `clientSecret` and cost data for the same.
See https://casbin.org/docs/rbac for more information about casbin rules.
204
204
205
+
## Migration Guide: Permission Name Separator Change
206
+
207
+
> **Breaking change**: Cluster-specific and project-specific permission names now use `/` (slash) as the separator instead of `.` (dot).
208
+
209
+
Previous versions used a dot separator (e.g., `ros.demolab.thanos`), which caused ambiguity when cluster names themselves contained dots (e.g., `ros.my.cluster.project` — is the cluster `my.cluster` and the project `project`, or the cluster `my` and the project `cluster.project`?).
210
+
211
+
The `/` separator eliminates this ambiguity: `ros/my.cluster/project` is unambiguous.
212
+
213
+
### What to update
214
+
215
+
Replace all dot-separated cluster/project permission names in your RBAC policy CSV:
216
+
217
+
| Old format (dot separator) | New format (slash separator) |
0 commit comments