fix(chart): drop unused RBAC verbs from API server and node-data-broker ClusterRoles - #384
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
@dmitsh when you have a moment — this is the low-risk half of an RBAC least-privilege pass on the chart: it drops verbs that no code path exercises (API server The larger, discuss-first changes from the same audit are tracked separately in #386 (engine/provider-gate the main role), #387 (hardened securityContext defaults, breaking), and #388 (opt-in VAP for the broker). Thanks! |
Greptile SummaryThis PR removes provably-unused RBAC verbs from the
Confidence Score: 5/5Safe to merge — only Helm RBAC templates, snapshot, and test files are changed; retained verbs are backed by concrete Go call sites. Every dropped verb was cross-referenced against the actual Go client-go call sites: the codebase has no Pods().Get, DaemonSets().List, ConfigMaps().List, or Nodes().List in the node-data-broker binary. The GetDaemonSetPods helper uses DaemonSets().Get and Pods().List — both retained. The broker's apply function uses only Nodes().Get and Nodes().Update — both retained. Tests cover both the positive (new verb set present) and negative (old verb set absent) cases, making accidental reversion detectable. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph topograph["topograph API Server ClusterRole"]
P1["pods\n✓ list\n✗ ~~get~~ (removed)"]
N1["nodes\n✓ get, list, update"]
DS1["daemonsets\n✓ get\n✗ ~~list~~ (removed)"]
CM1["configmaps (slinky only)\n✓ create, get, update\n✗ ~~list~~ (removed)"]
end
subgraph broker["node-data-broker ClusterRole"]
N2["nodes\n✓ get, update\n✗ ~~list~~ (removed)"]
DS2["daemonsets (IB only)\n✓ get\n✗ ~~list~~ (removed)"]
P2["pods (IB only)\n✓ list\n✗ ~~get~~ (removed)"]
PE["pods/exec (IB only)\n✓ create"]
end
subgraph go["Go call sites verified"]
GN["GetNodes → Nodes().List()"]
GDS["GetDaemonSetPods → DaemonSets().Get()"]
GPL["GetDaemonSetPods → Pods().List()"]
GNG["broker.apply → Nodes().Get()"]
GNU["broker.apply → Nodes().Update()"]
end
N1 --> GN
DS1 --> GDS
P1 --> GPL
N2 --> GNG
N2 --> GNU
DS2 --> GDS
P2 --> GPL
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
subgraph topograph["topograph API Server ClusterRole"]
P1["pods\n✓ list\n✗ ~~get~~ (removed)"]
N1["nodes\n✓ get, list, update"]
DS1["daemonsets\n✓ get\n✗ ~~list~~ (removed)"]
CM1["configmaps (slinky only)\n✓ create, get, update\n✗ ~~list~~ (removed)"]
end
subgraph broker["node-data-broker ClusterRole"]
N2["nodes\n✓ get, update\n✗ ~~list~~ (removed)"]
DS2["daemonsets (IB only)\n✓ get\n✗ ~~list~~ (removed)"]
P2["pods (IB only)\n✓ list\n✗ ~~get~~ (removed)"]
PE["pods/exec (IB only)\n✓ create"]
end
subgraph go["Go call sites verified"]
GN["GetNodes → Nodes().List()"]
GDS["GetDaemonSetPods → DaemonSets().Get()"]
GPL["GetDaemonSetPods → Pods().List()"]
GNG["broker.apply → Nodes().Get()"]
GNU["broker.apply → Nodes().Update()"]
end
N1 --> GN
DS1 --> GDS
P1 --> GPL
N2 --> GNG
N2 --> GNU
DS2 --> GDS
P2 --> GPL
Reviews (2): Last reviewed commit: "test(chart): assert broker IB pods verb ..." | Re-trigger Greptile |
|
Heads-up on the red |
…rRoles Tighten helm-unittest assertions for the api-server ClusterRole (pods, daemonsets, slinky configmaps rules) and the node-data-broker ClusterRole (nodes, IB daemonsets rules) to the exact verb sets they will hold after dropping unused verbs. Add notContains discriminators for the current (soon to be dropped) verb sets so the suite fails if an unused verb reappears. RED: 5 tests fail against the current (un-edited) templates. Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
Least-privilege pass on the RBAC audit (F4, main+broker scope only; node-observer is out of scope, see PR2): - api-server ClusterRole: pods rule drops get (list-only, used only to LIST pods for InfiniBand nvidia-smi discovery), daemonsets rule drops list (get-only), slinky configmaps rule drops list. - node-data-broker ClusterRole: nodes rule drops list (get/update, the broker patches individual named nodes), InfiniBand daemonsets rule drops list (get-only), InfiniBand pods rule drops get (list-only). GREEN: all helm-unittest suites pass; render snapshot refreshed via make chart-test-update-snapshot, diff limited to the dropped verbs. Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
The infiniband-k8s broker pods rule verb drop ([get,list] -> [list]) had no guarding assertion; only the snapshot suite covered it, but no fixture renders the broker as provider=infiniband-k8s, so the drop was untested. Add a contains [list] + notContains [get,list] pair to the existing infiniband-k8s test. Mutation-verified: reverting the verb to [get,list] turns this test red. Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
96b0d41 to
ab59880
Compare
|
@dmitsh this one is approved as well. One heads-up before merge: after the rebase onto your 1.26.5 bump, the presubmit didn't re-run on the current head ( |
Description
Removes provably-unused RBAC verbs from the Topograph API server and node-data-broker
ClusterRoles, tightening them toward least privilege. No runtime behavior changes — every dropped verb has zero call sites in the codebase.Dropped verbs:
topograph):pods: get,daemonsets: list,configmaps: list(slinky engine rule)nodes: list,daemonsets: list(IB rule),pods: get(IB rule)Each removal was cross-referenced against actual
client-gousage: the observer/broker/engine code paths useList/Watch/Get/Update/Createonly where retained, and never exercise the dropped verbs (e.g. noPods().Get, noDaemonSets().List, noConfigMaps().Listanywhere; the broker uses no informers and never lists nodes). The retained verbs are unchanged, so no supported provider/engine combination loses a grant it uses.Helm-unittest coverage was extended with discriminating
contains/notContainsassertions inrbac_test.yamlandsubchart_rbac_test.yaml(each mutation-verified to fail if a dropped verb reappears), and the render snapshot was refreshed.Checklist
git commit -s).