Commit ab26a80
fix(cost-management): move data fetching server-side to eliminate token exposure and RBAC bypass (#2616)
* fix(cost-management): move data fetching server-side to eliminate token exposure and RBAC bypass
Addresses security findings from the RHDH Cost Plugin threat model:
- Removed /token endpoint that exposed SSO credentials to the browser
- Added secure backend proxy (/api/cost-management/proxy/*) with server-side
RBAC enforcement and internal SSO token management
- Removed dangerously-allow-unauthenticated proxy configuration
- Updated frontend clients to route through the secure backend proxy
FLPATH-3487
Made-with: Cursor
* docs(cost-management): update documentation for server-side proxy architecture
- Remove all references to dangerously-allow-unauthenticated proxy configuration
- Document new secure backend proxy architecture and endpoints
- Update static and dynamic plugin setup instructions
- Add server-side RBAC enforcement explanation to rbac.md
Made-with: Cursor
* fix(cost-management): address review - path traversal and encoded RBAC bypass
- Reject proxyPath containing dot-segments (../) or leading slashes to prevent
path traversal beyond /cost-management/v1/
- Post-construction check ensures resolved pathname stays under the base path
- Decode query parameter keys before RBAC matching so percent-encoded variants
(e.g. filter%5Bexact%3Acluster%5D) are correctly stripped
- Replace regex-based stripping with Set-based decoded key lookup
Made-with: Cursor
* refactor(cost-management): extract common RBAC resolution to reduce duplication
Extract resolveAccessForSection() to eliminate structural duplication between
resolveOptimizationsAccess and resolveCostManagementAccess. Each section now
provides only a data-fetching callback while the common authorize-cache-filter
logic lives in one place.
Made-with: Cursor
* fix(cost-management): harden secure proxy — hardcode GET method and declare config schema
Defense-in-depth: hardcode fetch method to 'GET' instead of passing req.method,
preventing SSRF amplification if the route registration ever changes from router.get
to router.all. Add costManagementProxyBaseUrl to config.d.ts with @visibility backend
so the config key is schema-validated and documented.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor(cost-management): reduce secureProxy cognitive complexity
Extract three helper functions from the secureProxy handler to bring
cognitive complexity from 24 down below the SonarQube threshold of 15:
- isPathTraversal: path validation guard
- parseClientQueryParams: query string parsing with RBAC key stripping
- injectRbacFilters: server-side RBAC filter injection
Made-with: Cursor
* docs(cost-management): update dynamic plugin config with full route bindings
Add missing OpenShift route, menu hierarchy, and explain why the
proxy.endpoints config was removed (replaced by server-side secure proxy).
Made-with: Cursor
* docs(cost-management): align dynamic-plugin.md with verified deployment config
Update the ConfigMap example to exactly match the working configuration
deployed on ocp-edge73: icon reference name costManagementIcon and
dot-separated menuItems keys (cost-management.optimizations).
Made-with: Cursor
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 3f740e4 commit ab26a80
15 files changed
Lines changed: 604 additions & 444 deletions
File tree
- workspaces/cost-management
- .changeset
- docs
- plugins
- cost-management-backend
- src
- routes
- service
- cost-management-common
- src/clients
- cost-management
- optimizations
- cost-management
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
64 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
8 | 21 | | |
9 | 22 | | |
10 | 23 | | |
| |||
Lines changed: 40 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
6 | 44 | | |
7 | 45 | | |
8 | 46 | | |
| |||
Lines changed: 0 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | 1 | | |
8 | 2 | | |
9 | 3 | | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
32 | 41 | | |
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
0 commit comments