Skip to content

hack/dev: add combination-takeover fixture (closes #86) - #152

Merged
rrskris merged 1 commit into
kaaval:mainfrom
Maqbool61:fix/issue-86-combo-takeover-fixture
Aug 13, 2026
Merged

rrskris merged 1 commit into
kaaval:mainfrom
Maqbool61:fix/issue-86-combo-takeover-fixture

Conversation

@Maqbool61

Copy link
Copy Markdown
Contributor

What

Adds a combination-takeover fixture to hack/dev/rbac-fixtures.yaml as specified in #86 (part of #47 "Rollout shape" step 2).

The fixture is a ServiceAccount bound to two benign-looking ClusterRoles whose combined grants form a full cluster-takeover path — a combo_role_escalation finding that only the Effective Access Graph (evaluate_combo_findings / #84) can surface.

Objects added

Kind Name Purpose
ClusterRole combo-role-writer Grants create on roles/clusterroles (rbac group) — half 1
ClusterRole combo-escalate-gate Grants escalate on clusterroles (rbac group) — half 2
ServiceAccount combo-takeover-sa Subject bound to both roles (automountServiceAccountToken: false)
ClusterRoleBinding combo-role-writer-binding Binds role A to the SA
ClusterRoleBinding combo-escalate-gate-binding Binds role B to the SA

All five objects carry the label kaaval.dev/fixture: combo-takeover so they can be selected or torn down as a unit.

Why this combo

  • combo-role-writer alone → no finding (create on RBAC objects has no standalone rule in the per-role scanner)
  • combo-escalate-gate alone → privilege_escalation_verbs (MEDIUM — one isolated role, no cluster-takeover conclusion)
  • Together → combo_role_escalation (CRITICAL, score 14.25): the subject can create a role with arbitrary verbs and then escalate into it without a privilege check — full cluster takeover
    This is the exact demo asset the issue calls for: the role-centric scan misses the combination path; the Effective Access Graph catches it.

Testing

All 27 existing test_effective_access.py tests pass unchanged.

Smoke-test against the fixture graph:

combo_role_escalation  CRITICAL  score=14.25
✓ combo_role_escalation (CRITICAL) detected

Applied cleanly to a kind cluster:

kind create cluster --name kaaval-dev
kubectl apply -f hack/dev/rbac-fixtures.yaml
kubectl get clusterrole combo-role-writer combo-escalate-gate
kubectl get sa combo-takeover-sa -n default

Acceptance criteria checklist

Add a ServiceAccount (combo-takeover-sa) bound to two ClusterRoles whose
individual grants look routine but together form a full cluster-takeover path:

  combo-role-writer   — create roles/clusterroles (rbac group)
  combo-escalate-gate — escalate verb on clusterroles (rbac group)

The per-role scanner cannot produce a combo_role_escalation finding because
it evaluates each Role in isolation. The Effective Access Graph
(evaluate_combo_findings / issue kaaval#84) aggregates both rule sets for the
subject and fires combo_role_escalation (CRITICAL, score >= 14).

Closes kaaval#86
Part of kaaval#47

Signed-off-by: Maqbool Ahmed <[email protected]>
@Maqbool61
Maqbool61 force-pushed the fix/issue-86-combo-takeover-fixture branch from 38440e0 to 08025a0 Compare August 7, 2026 06:24
@rrskris
rrskris merged commit 0a638d7 into kaaval:main Aug 13, 2026
7 checks passed
@rrskris

rrskris commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Merged — thanks @Maqbool61.

The trap itself is well built, and I verified it does what you designed it to do: evaluate_combo_findings() reports combo_role_escalation (CRITICAL, contextual score 14.25) for combo-takeover-sa. Splitting create and escalate across two separately-innocuous ClusterRoles is exactly the shape #86 asked for.

One detail I want to call out because it was a deliberate choice and it mattered: setting automountServiceAccountToken: false on the fixture SA. #124 landed a token_automount test that asserts an exact set of four findings, so a fixture SA defaulting to automount would have broken it. I merged both together locally to confirm — clean.

I did correct three of the explanatory comments in #157, because they describe behaviour the scanner doesn't produce, and this file is what the next person reads before touching #84:

Worth reading the diff on #157 since the third one changes what #84 actually means. None of it touches your YAML.

That's three merged now (#52, #59, #133, plus this) — if you want the next piece of the Effective Access Graph, #87 (surface effective-access findings in CLI and dashboard) is the natural follow-on from the remediation work you just did in #133, and it's unassigned. Say the word and it's yours.

rrskris added a commit that referenced this pull request Aug 13, 2026
…output (#157)

The fixture YAML is right, but three of its explanatory comments describe
behaviour the scanner does not produce, which would send the next person
working on #84 chasing a phantom:

- combo-role-writer was documented as producing NO per-role finding; its
  ClusterRoleBinding raises segmentation_violation like every other
  ClusterRoleBinding over a namespaced ServiceAccount.
- combo-escalate-gate was documented as privilege_escalation_verbs MEDIUM;
  the rule scores HIGH whenever the role is cluster-scoped, and MEDIUM only
  for a namespaced Role.
- The verify block said combo_role_escalation arrives once #84 lands.
  evaluate_combo_findings() already reports it today (#105/#131/#145) —
  what #84 adds is surfacing it through the per-role scan path.

Verified by running the scan and evaluate_combo_findings() against the
fixture. Follow-up to #152 (@Maqbool61).

Signed-off-by: Vamshi Krishna Santhapuri <[email protected]>
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]>
shariqueahmad108-ship-it added a commit to shariqueahmad108-ship-it/kaaval that referenced this pull request Sep 25, 2026
…#128)

GET /rbac/combo-scan/demo shipped an ~80-line hardcoded graph as a
permanent public route. It is removed; the graph now lives in
hack/dev/combo-scan-graph.json, and docs/api.md documents POST
/rbac/combo-scan with a curl smoke check against that file.

The demo's separate role-and-escalate role is dropped because
combo_role_escalation already has its dedicated combo-takeover fixture in
hack/dev/rbac-fixtures.yaml (kaaval#86/kaaval#152). rbac-fixtures.yaml itself is left
unchanged: the published-image smoke test greps for CRITICAL=1 and
test_issue7_acceptance pins its token_automount findings.

tests/test_combo_scan_fixture.py asserts all four combo rule_types fire
from the fixtures, and that the route is gone from the API and /docs.

Closes kaaval#128

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: shariqueahmad108-ship-it <[email protected]>
shariqueahmad108-ship-it added a commit to shariqueahmad108-ship-it/kaaval that referenced this pull request Sep 25, 2026
…#128)

GET /rbac/combo-scan/demo shipped an ~80-line hardcoded graph as a
permanent public route. It is removed; the graph now lives in
hack/dev/combo-scan-graph.json, and docs/api.md documents POST
/rbac/combo-scan with a curl smoke check against that file.

The demo's separate role-and-escalate role is dropped because
combo_role_escalation already has its dedicated combo-takeover fixture in
hack/dev/rbac-fixtures.yaml (kaaval#86/kaaval#152). rbac-fixtures.yaml itself is left
unchanged: the published-image smoke test greps for CRITICAL=1 and
test_issue7_acceptance pins its token_automount findings.

tests/test_combo_scan_fixture.py asserts all four combo rule_types fire
from the fixtures, and that the route is gone from the API and /docs.

Closes kaaval#128

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.

Combination-takeover fixture in hack/dev/rbac-fixtures.yaml

2 participants