Skip to content

fix(kyverno): record reviewed RBAC exclusions as a current skip - #3906

Merged
devantler merged 1 commit into
mainfrom
claude/kyverno-rbac-exclusion-skip-3900
Sep 19, 2026
Merged

devantler merged 1 commit into
mainfrom
claude/kyverno-rbac-exclusion-skip-3900

Conversation

@devantler

Copy link
Copy Markdown
Contributor

🤖 Generated by the Agentic Engineer

Why

The policy-report dashboard shows 14 privileged-RBAC warnings (12 cluster-wide, 2 namespaced) for roles the platform has already reviewed and accepted. They were reported before being accepted, and the way the policy exempts them records nothing new, so the old warnings never go away. They inflate the count and make a real new warning harder to spot.

What

The reviewed exemptions now record a current "skipped" result on every background scan, so an accepted role shows as accepted and its old warning is replaced. The list of exempted roles, and the rule that each exemption covers exactly one role in one place, are unchanged. Deployment is unchanged too: Flux applies it and the next hourly scan clears the 14 warnings.

Fixes #3900

The privileged-RBAC policy exempted its reviewed roles with a rule
`exclude`, which produces no result, so the warnings those roles had
before they were accepted stayed in their reports indefinitely (14 on
prod). Express the same exact kind|namespace|name identities as a false
precondition instead, so each background scan records a current skip.

The shape test pins the new precondition verbatim and asserts, from the
policy report, that exactly the reviewed fixtures skip and their
same-name lookalikes still fail; kyverno test pairs rows by name alone,
so those rows move out of it.

Fixes #3900

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@coderabbitai review

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

Tried as a user, at head 7922d006.

  • Prod, before (read-only, 2026-09-19 ~16:00Z): audit-privileged-rbac holds 12 stale warn results in ClusterPolicyReports and 2 in namespaced PolicyReports, every one older than 6h; the rule's other 270 results are fresh pass.
  • The background-scan result the change produces: kyverno apply --policy-report (Kyverno 1.19.1, the CI version) on the policy's fixtures records ClusterRole||crossplane-rbac-manager and Role|velero|velero-server as skip with process: background scan, while the same-name lookalikes Role|sample|velero-server, ClusterRole||velero-server and ClusterRole||crossplane-rbac-manager-lookalike still fail. Census: pass: 15, fail: 24, warn: 0, error: 0, skip: 2.
  • RED: the unchanged policy fails the new shape check, and with shape and census neutralised it fails the new report assertion alone (did not skip exactly the reviewed exclusions).
  • ksail workload validate passes for both overlays; test-chart-rendered-rbac-policy.sh passes against the new precondition inventory.
  • After merge: confirm on prod that the 14 stale results are replaced by fresh skip results after one hourly background scan (acceptance criterion on Reviewed privileged-RBAC exclusions leave 12 stale warnings in cluster policy reports #3900).

@coderabbitai

coderabbitai Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

@devantler: I will review the changes.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 62199d7e-ec68-4451-9f52-98d2e10e63ca

📥 Commits

Reviewing files that changed from the base of the PR and between e0cce89 and 7922d00.

📒 Files selected for processing (5)
  • docs/rbac-audit.md
  • k8s/bases/infrastructure/cluster-policies/best-practices/audit-privileged-rbac.yaml
  • scripts/tests/test-audit-privileged-rbac.sh
  • scripts/tests/test-chart-rendered-rbac-policy.sh
  • tests/audit-privileged-rbac/kyverno-test.yaml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-19T16:36:14.660023Z 7922d00 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 7922d00623

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@devantler
devantler marked this pull request as ready for review September 19, 2026 16:37
@devantler
devantler added this pull request to the merge queue Sep 19, 2026
Merged via the queue into main with commit cc2acd5 Sep 19, 2026
30 checks passed
@devantler
devantler deleted the claude/kyverno-rbac-exclusion-skip-3900 branch September 19, 2026 16:49
@github-project-automation github-project-automation Bot moved this from 🫴 Ready to ✅ Done in 🌊 Project Board Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Reviewed privileged-RBAC exclusions leave 12 stale warnings in cluster policy reports

1 participant