rbac-hardening

Audit and narrow Kubernetes RBAC grants, security contexts, and privilege escalation primitives.

4|Updated Dec 1, 2025
One-click install
npx skills add https://github.com/simplyblock/simplyblock-operator --skill rbac-hardening-simplyblock
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rbac-hardening
Source: https://github.com/simplyblock/simplyblock-operator/tree/main/.claude/skills/rbac-hardening
Command: npx skills add https://github.com/simplyblock/simplyblock-operator --skill rbac-hardening-simplyblock

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Kubernetes permissions in this repository live in four places—kubebuilder RBAC markers, roles the operator builds in Go, hand-written chart roles and bindings, and workload security contexts—and most tooling audits only the first, leaving cluster-wide escalation primitives like pods/exec unexamined. ## Core Features & Use Cases - Four-source RBAC audit: The check-rbac.py script scans kubebuilder markers, Go-built roles, chart YAML, and workload security contexts, classifying findings against a severity-ranked list of escalation primitives (escalate, bind, impersonate, pods/exec, secret read, wildcard verbs). - Justification workflow: Reviewed grants carry an rbac-justified note stating what needs the permission, so audits distinguish deliberate decisions from unexamined surface, with --unjustified and --severity filters for triage. - Hardening guidance: Reference documents catalog which privileges the NVMe-oF data path genuinely requires (privileged CSI node plugin, host paths) versus sidecars that need none, plus the narrowest-scope-first ladder for any new grant. - Use Case: When adding a kubebuilder RBAC marker or a privileged container, run the checker with --changed to confirm nothing critical or high was introduced without justification before handing the change back. ## Quick Start Ask the AI to audit the repository's Kubernetes RBAC grants and security contexts for unjustified privilege escalation primitives using the rbac-hardening skill.

Frequently Asked Questions about rbac-hardening

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit Kubernetes RBAC for privilege escalation risks?

Run the check-rbac.py script, which scans kubebuilder markers, Go-built roles, chart YAML, and workload security contexts for escalation primitives like pods/exec, secret read, bind, and impersonate. Use --severity high or --unjustified to focus on findings nobody has reviewed.

How do I add a kubebuilder RBAC marker under least privilege?

Add the marker at the narrowest scope that works: prefer resourceNames, read-only verbs, and exact verb lists over the scaffolded seven-verb block. Then run make -C operator manifests generate, sync the Helm chart, and verify with check-rbac.py --changed.

Why should I never hand-edit the generated role.yaml in a kubebuilder project?

The operator/config/rbac/role.yaml file is generated from kubebuilder RBAC markers, so manual edits are overwritten by the next make manifests run. Narrow the marker in the Go source instead, then regenerate and sync the chart copy.

Does a CSI node plugin need a privileged container?

Yes, NVMe-oF attachment is a host-kernel operation requiring /dev, /sys, /lib/modules, and mount propagation into the kubelet directories. The rule is to use the narrowest form that works, document it with an rbac-justified note, and state what a container escape would reach.

What is wrong with binding a role to the default ServiceAccount?

A binding to the default ServiceAccount grants the permission to every pod in the namespace that does not name an identity, and it cannot be revoked from a single component. The fix is a dedicated ServiceAccount per component named in the pod spec.

What are the limitations of a source-based RBAC audit versus a live cluster audit?

The checker reads source code, so it finds intended grants and runs in CI, but a live cluster can hold grants no chart creates, such as hand-installed operators or OLM bindings. A cluster audit requires kubectl auth can-i --list per service account and comparing clusterrolebindings against the charts.