fix(cost-management): register dynamic RBAC permissions for cluster/project tiers (FLPATH-4207)#3193
Open
hardengl wants to merge 2 commits into
Open
Conversation
…roject tiers (FLPATH-4207) Cluster-specific permissions (ros/<cluster>, ros/<cluster>/<project>) were created at runtime but never registered with createPermissionIntegrationRouter. The RHDH RBAC backend only evaluates registered permissions — unregistered ones get DENY by default, breaking the entire 3-tier RBAC model. At router init, fetch cluster/project data from upstream APIs and register all dynamic permissions. Also improve secureProxy.ts error messages (include path and error details instead of opaque "Internal proxy error"). Co-authored-by: Cursor <cursoragent@cursor.com>
Changed Packages
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3193 +/- ##
==========================================
+ Coverage 60.97% 60.99% +0.01%
==========================================
Files 2098 2098
Lines 65140 65181 +41
Branches 17029 17034 +5
==========================================
+ Hits 39721 39756 +35
- Misses 25180 25186 +6
Partials 239 239
*This pull request uses carry forward flags. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
- Extract extractStrings() and buildClusterProjectPermissions() helpers to flatten nested if/for blocks (SonarCloud cognitive complexity 33→8) - Add 8 unit tests covering both helpers (fulfilled/rejected/empty/dedup) - Add changeset for cost-management-backend patch release Co-authored-by: Cursor <cursoragent@cursor.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Cluster-specific RBAC permissions (
ros/<cluster>,ros/<cluster>/<project>, and theircost/equivalents) are created dynamically at runtime byfetchDynamicPermissions()but were never registered withcreatePermissionIntegrationRouter. The RHDH RBAC backend'sPluginPermissionMetadataCollectoronly evaluates registered permissions — unregistered ones get DENY by default. This broke the entire 3-tier RBAC model: onlyros.plugin(tier 1) ever worked.Changes
router.ts— At router init, fetch cluster/project data from the upstream Cost Management APIs and register allros/<cluster>,ros/<cluster>/<project>,cost/<cluster>, andcost/<cluster>/<project>permissions with the integration router. UsesPromise.allSettledso a partial failure (e.g. one API down) doesn't block other permissions from registering.secureProxy.ts— Improved error logging and response messages. Previously returned opaque"Internal proxy error"for all non-SSO exceptions; now includes the request path and error details for easier debugging.Proof the fix works
Verified on a live RHDH instance (
ocp-edge73) with OCI imagequay.io/gharden/cost-management-dynamic-plugins:2.2.0-rc.1.Tier 1:
ros.plugin— full access (396 containers, no filters)No permissions — access denied
Tier 2:
ros/<cluster>only — cluster-filtered (10 containers, down from 396)Tier 3:
ros/<cluster>/<project>only — cluster+project filteredBackend audit logs
CI
flightpath-ros #95 — 89 passed, 2 failed (pre-existing flaky), 4 skipped. All 21 RBAC E2E tests passed.
Limitation
Dynamic permissions are registered once at startup. New clusters added after RHDH starts won't be recognized until the pod restarts. A periodic refresh mechanism would be a more complete solution.
Related
Made with Cursor