Skip to content

feat(rbac): remediation entries and docs for combo-escalation rule_types (#88 + #129) - #133

Merged
rrskris merged 2 commits into
kaaval:mainfrom
Maqbool61:feat/88-129-combo-remediation-and-docs
Aug 13, 2026
Merged

rrskris merged 2 commits into
kaaval:mainfrom
Maqbool61:feat/88-129-combo-remediation-and-docs

Conversation

@Maqbool61

Copy link
Copy Markdown
Contributor

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 privilege as its
action and was absent from the user-facing rule catalogue.

Changes

control-plane/app/remediation.py

Added entries to _CIS_REFS and _RBAC_ACTIONS for all four rule_types:

rule_type Action Citations
combo_role_escalation Break the combination — remove create-roles OR escalate CIS 5.1.8, RBAC Good Practices
combo_bind_escalation Break the combination — remove create-bindings OR bind CIS 5.1.8, RBAC Good Practices
impersonation_grant Remove impersonate verb from every role the subject holds CIS 5.1.8
privileged_pod_creation Remove create-pods OR remove the privileged SA from the namespace CIS 5.1.4, RBAC Good Practices

No 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_grant precedent already
in the file.

control-plane/tests/test_effective_access.py

Added TestComboRemediationCoverage (3 tests):

  • test_every_combo_rule_type_has_remediation — asserts no combo rule_type falls through to the generic Role '?' template
  • test_combo_remediation_has_benchmark_refs — asserts every finding carries at least one verified benchmark citation
  • test_combo_remediation_has_audit_note — asserts audit_note is populated for access-review log

docs/rbac-rules.md

Added a Combination-escalation rules section with:

  • Intro paragraph explaining these fire on the aggregate rule set across all bindings, not a single Role — the distinction that makes the Effective Access Graph different from the per-role scanner
  • One row per rule_type matching existing column format (trigger, severity, citation)
  • Per-rule notes explaining the attack path and stating explicitly where no CIS control covers the combination

Citations verified

  • CIS 5.1.8 — "Limit use of the Bind, Impersonate, and Escalate permissions" ✅
  • CIS 5.1.4 — "Minimize access to create pods" ✅
  • Kubernetes RBAC Good Practices — "Risks of Granting Create Verbs" section ✅
  • privileged_pod_creation and the two combo rules have no CIS control for the combination itself — stated explicitly, not papered over

Testing

# All tests
KAAVAL_ADMIN_PASSWORD=test-admin-password \
  python -m pytest tests/test_effective_access.py tests/test_rbac_service.py -v
# 60 passed

# Remediation-specific (issue #88 verify command)
KAAVAL_ADMIN_PASSWORD=test-admin-password \
  python -m pytest tests/test_effective_access.py tests/test_rbac_service.py -k remediation -v
# 5 passed

# Docs check (issue #129 verify command)
grep -n "combo_role_escalation\|combo_bind_escalation\|impersonation_grant\|privileged_pod_creation" docs/rbac-rules.md
# 8 lines — 4 table rows + 4 notes

@rrskris rrskris left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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.
  2. 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 scan still 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]>
@Maqbool61
Maqbool61 force-pushed the feat/88-129-combo-remediation-and-docs branch from 3605caf to e23031c Compare August 5, 2026 06:49
@Maqbool61

Copy link
Copy Markdown
Contributor Author

Restructured the docs as requested:

  • Renamed ## Rules → ## Per-role rules (single-role evaluation) and moved
    the "produced per (risky role, binding) pair" paragraph directly under it,
    above the table where it belongs
  • Moved ## Combination-escalation rules to after the per-role notes block,
    immediately before ## Suppression rules

Didn't touch the trigger column — leaving the api_groups qualifier for #142
to add as part of their own fix, and will rebase onto main after #131 merges
as you suggested.

@Maqbool61
Maqbool61 requested a review from rrskris August 5, 2026 06:50
…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]>
@Maqbool61

Copy link
Copy Markdown
Contributor Author

@rrskris Any update?

@rrskris
rrskris merged commit 55968dd into kaaval:main Aug 13, 2026
7 checks passed
rrskris added a commit that referenced this pull request Aug 13, 2026
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]>
@Maqbool61
Maqbool61 deleted the feat/88-129-combo-remediation-and-docs branch August 13, 2026 11:33
shariqueahmad108-ship-it added a commit to shariqueahmad108-ship-it/kaaval that referenced this pull request Aug 13, 2026
…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.
shariqueahmad108-ship-it added a commit to shariqueahmad108-ship-it/kaaval that referenced this pull request Aug 13, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: rbac-rules.md rows for the four combination-escalation rule_types Remediation entries for effective-access rule_types (verified citations only)

2 participants