Repository navigation
feat(rbac): remediation entries and docs for combo-escalation rule_types (#88 + #129) - #133
Conversation
rrskris
left a comment
There was a problem hiding this comment.
Thanks for taking both halves of this — the remediation entries are the part that actually changes what a user sees, and they're right. One structural change needed in the docs before I merge, plus a coordination note.
The remediation work is solid
I checked the two things I'd normally worry about here.
The citations are real. 5.1.8 / "Limit use of the Bind, Impersonate, and Escalate permissions" and 5.1.4 / "Minimize access to create pods" match the existing verified entries in remediation.py verbatim — you reused what was already confirmed rather than paraphrasing new titles into existence. Where no control covers the combination you said so in a comment instead of reaching for the nearest plausible ID. That's the standard for this file and you met it.
Two of your three tests are real tests. I reverted remediation.py to main and reran them:
FAILED test_every_combo_rule_type_has_remediation
FAILED test_combo_remediation_has_benchmark_refs
1 passed
They fail without the change, which is what makes them worth having. Full suite on your branch: 128 passed.
The one that passes either way is test_combo_remediation_has_audit_note — audit_note is populated generically, so it holds on main too. Not wrong, just not pinning anything this PR does. Keep it if you like it as a shape assertion; I'm not going to ask you to delete a passing test.
Required: the docs restructure orphans the per-role notes
This is the one blocking item. Inserting the combo section directly after the main table splits that table from the notes that explain it. After this PR the document reads:
## Rules <- the per-role table
## Combination-escalation rules <- new section, 46 lines
## Per-role rules (single-role evaluation) <- no table, just "Notes on the less obvious ones:"
Two problems. ## Per-role rules promises a rule listing and delivers prose about rules the reader scrolled past two sections ago. And ## Rules is now the mis-titled one — it is the per-role table, but it keeps the generic name while the section actually called "Per-role rules" has no rules in it.
What I want instead:
- Rename
## Rules→## Per-role rules (single-role evaluation)and move your "produced per (risky role, binding) pair" paragraph up under it, directly above the table. That paragraph is a genuine improvement — it belongs with the thing it describes. - Move your combo section to after the per-role notes block, immediately before
## Suppression rules.
That keeps each table with its own notes and puts the combo rules where a reader arrives having already understood the per-role model — which is the order they need them in, since the whole point of the combo rules is the contrast.
Coordination: #142 covers the same ground
Heads-up so this doesn't surprise you — #142 also adds a combo section to docs/rbac-rules.md, opened before yours. The two do not conflict in git. Different insertion points, so both apply cleanly and the merged file ends up with ## Combination-escalation rules (Effective Access Graph) twice. I tested it; that's not a hypothetical.
I'm treating yours as the source of truth, because you change remediation.py in the same PR and the doc table has to match what the code actually emits. #142's table cites OWASP K03 for privileged_pod_creation, which your remediation entry doesn't carry — docs-only can't know that, and this is exactly why. I'm asking #142 to rebase onto yours afterwards and reduce to the one thing yours doesn't cover (the api_groups qualifier).
Which brings up the sequencing: #131 lands before this. It scopes the combo predicates to their API groups, so create on roles/clusterroles will only count in rbac.authorization.k8s.io. Your trigger column doesn't mention groups. Don't add it — I'd rather that qualifier come in as #142's contribution since it's the doc half of their own fix — just rebase on main after #131 merges so the two don't fight.
Restructure the docs as above and this is ready. The remediation half needed no changes at all, which is the harder half.
What's next, if you want it
You've now done the predicates (#105) and their remediation entries (#88) — you know effective_access.py better than anyone except me. Two things follow naturally:
- #86 — combination-takeover fixture in
hack/dev/rbac-fixtures.yaml. Small, and you're the obvious person: it needs a fixture that actually trips the predicates you wrote, which means knowing exactly what they key on. - #87 — surface effective-access findings in the CLI and dashboard. Bigger, and the one I'd most like to see land. Right now these four CRITICAL rule_types fire correctly and carry proper remediation thanks to this PR, but a user running
kaaval scanstill doesn't see them distinguished from per-role findings. That's the last gap between "the engine detects it" and "someone acts on it."
If you want something further out, #89/#90 (blast-radius metric, then folding it into compute_contextual_score()) is the next real piece of the risk model and it's still at the design stage — so there's room to shape it rather than implement to a spec.
Comment on whichever one and I'll assign it to you. Sorry again about the #129 collision — that one's on me, and assigning up front is the fix.
…mbo block - Rename '## Rules' → '## Per-role rules (single-role evaluation)' and move the 'produced per (risky role, binding) pair' paragraph under it, directly above the table where it belongs - Move '## Combination-escalation rules' to after the per-role notes block, immediately before '## Suppression rules', so a reader arrives at the combo section having already understood the per-role model Addresses review comment on kaaval#133 Signed-off-by: Maqbool Ahmed <[email protected]>
3605caf to
e23031c
Compare
|
Restructured the docs as requested:
Didn't touch the trigger column — leaving the |
…al#88) Add remediation.py entries for the four combination-escalation rule_types shipped in kaaval#105: - combo_role_escalation → CIS 5.1.8 + RBAC Good Practices - combo_bind_escalation → CIS 5.1.8 + RBAC Good Practices - impersonation_grant → CIS 5.1.8 - privileged_pod_creation → CIS 5.1.4 + RBAC Good Practices Add TestComboRemediationCoverage (3 tests) asserting no combo rule_type falls through to the generic Role '?' template. Closes kaaval#88 Signed-off-by: Maqbool Ahmed <[email protected]>
|
@rrskris Any update? |
Adds release-notes entries for the five contributor PRs merged today: Grype ingestion (#123, @Diyaaa-12), combo-escalation remediation and rule catalog (#133, @Maqbool61), the combination-takeover fixture (#152, @Maqbool61), the Postgres-unreachable test skip (#151, @HeaTTap — first contribution), and the CIS 5.1.6 acceptance check moving into CI (#124, @donkk11). Also records the fixture-comment correction from #157. Signed-off-by: Vamshi Krishna Santhapuri <[email protected]>
…aval#129) Rebased on main and cut down to the single api_groups bullet reserved for this PR — the combination-escalation section itself landed via kaaval#133. Documents that roles/clusterroles/rolebindings/clusterrolebindings only count in the rbac.authorization.k8s.io group and users/groups/serviceaccounts/pods only in the core group, so a CRD reusing one of those resource names in an unrelated group does not trigger these rules (kaaval#125). Also notes that a rule which omits api_groups is treated as unspecified and still counts, matching _has_resource in effective_access.py.
…aval#129) Rebased on main and cut down to the single api_groups bullet reserved for this PR — the combination-escalation section itself landed via kaaval#133. Documents that roles/clusterroles/rolebindings/clusterrolebindings only count in the rbac.authorization.k8s.io group and users/groups/serviceaccounts/pods only in the core group, so a CRD reusing one of those resource names in an unrelated group does not trigger these rules (kaaval#125). Also notes that a rule which omits api_groups is treated as unspecified and still counts, matching _has_resource in effective_access.py. Signed-off-by: shariqueahmad108-ship-it <[email protected]>
What
Closes #88. Closes #129.
Natural continuation of #105 — the four combination-escalation rule_types
shipped there had no remediation entries and no docs rows, so every combo
finding rendered
Review and narrow Role '?' to least privilegeas itsaction and was absent from the user-facing rule catalogue.
Changes
control-plane/app/remediation.pyAdded entries to
_CIS_REFSand_RBAC_ACTIONSfor all four rule_types:rule_typecombo_role_escalationcombo_bind_escalationimpersonation_grantprivileged_pod_creationNo invented control IDs. Where no CIS control covers the combination
directly, the Kubernetes RBAC Good Practices doc is cited instead and
stated explicitly — matching the
exec_attach_grantprecedent alreadyin the file.
control-plane/tests/test_effective_access.pyAdded
TestComboRemediationCoverage(3 tests):test_every_combo_rule_type_has_remediation— asserts no combo rule_type falls through to the genericRole '?'templatetest_combo_remediation_has_benchmark_refs— asserts every finding carries at least one verified benchmark citationtest_combo_remediation_has_audit_note— asserts audit_note is populated for access-review logdocs/rbac-rules.mdAdded a Combination-escalation rules section with:
Citations verified
privileged_pod_creationand the two combo rules have no CIS control for the combination itself — stated explicitly, not papered overTesting