audit-rbac-grants
Audit RBAC roles and bindings — find overbroad verbs (*), cluster-wide grants that should be namespaced, stale ServiceAccounts, anonymous access.
- License 许可
- MIT
- 最近更新
- 2026-10-29
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- audit-rbac-grants
- description
- Audit RBAC roles and bindings — find overbroad verbs (*), cluster-wide grants that should be namespaced, stale ServiceAccounts, anonymous access.
03 SKILL.md 正文
audit-rbac-grants
Read a set of RBAC manifests and flag the grants that are wider than they need to be.
Mode: analytical — judgment inside a fixed frame. Keep the output shape; every verdict cites its evidence; unknowns are marked [TBD] or [VERIFY], never filled in.
When to use
- A periodic RBAC review.
- A new operator/controller's manifest is being merged.
- A workflow needs an authz check before deploy.
Inputs
- The cluster's
Role,ClusterRole,RoleBinding,ClusterRoleBindingmanifests (or a YAML dump fromkubectl get … -o yaml). - The list of namespaces in the cluster (so cluster-wide grants stand out).
Procedure
- Cluster-wide vs namespaced:
ClusterRoleBindingto a workload's ServiceAccount → flag unless that workload genuinely needs cluster-wide read/write.- Prefer
RoleBindingreferencing aClusterRoleso the role definition is shared but the grant is namespaced.
- Verbs:
verbs: ["*"]→ flag every time. Always.verbs: ["create","update","patch","delete"]on Secrets / ServiceAccounts / RoleBindings → flag.get/list/watchon Secrets → flag:listandwatchreturn every secret's data in the namespace, so they are full read access, not "metadata".verbs: ["impersonate"],["escalate"], or["bind"]→ flag with high severity (each lets the holder gain permissions it doesn't have).
- Resources:
resources: ["*"]→ flag.nonResourceURLs: ["*"]→ flag.- Secrets / ServiceAccounts / RoleBindings / ClusterRoleBindings as resources for create/update verbs → privilege escalation risk; flag.
- Escalation sub-resources:
pods/exec,pods/attach,nodes/proxy,serviceaccounts/token(create), andcreateon pods/workloads in a namespace with powerful ServiceAccounts → flag.
- Subjects:
system:anonymousorsystem:unauthenticated→ flag immediately.kind: Groupreferencing OIDC groups → confirm group membership is documented.kind: Userwith an email → people move; prefer Group-based subjects.
- Stale: any RoleBinding pointing to a ServiceAccount or User that no longer exists is dead grant; flag.
Output
RBAC audit: <cluster or namespace>
HIGH severity:
- ClusterRoleBinding refund-admin → ServiceAccount payments/refund
Verbs: ["*"] on resources ["*"]. Namespaced scope is sufficient.
Fix: replace with RoleBinding in payments namespace; tighten verbs.
- ClusterRoleBinding lets system:anonymous list endpoints.
Fix: delete; default-deny anonymous.
MEDIUM:
- RoleBinding refund-ops grants verbs ["create","patch"] on secrets in
payments. Only "get" + "list" are needed for the workload's reads.
LOW (stale):
- RoleBinding old-job-runner → ServiceAccount that no longer exists.
Quality bar
- Every finding cites the binding name + namespace.
- Severity ordering: anonymous > impersonate/escalate > "*" verbs > secret-write > cluster-wide read > stale.
- "Fix" is a concrete change (binding type, narrower verbs), not "review with security team".
Anti-patterns to avoid
- Approving a
ClusterRolewith["*"]because "it's an operator" without checking what the operator actually uses. - Granting
impersonateto humans for "convenience". - Leaving stale bindings; they make future audits noisier.
04 同仓库更多 Skills
runbook
Write or refresh an operational runbook for an alert/symptom; structured as TL;DR + Pre-checks + Steps + Verification + Rollback + Escalation.
rfc
Draft a lightweight design RFC to docs/rfcs/<slug>.md; Summary, Motivation, Detailed design, Drawbacks, Alternatives, Unresolved questions. A proposal to debate, not a recorded decision (adr).
editorial-pass
Review and tighten prose in a Markdown artifact for a target tone (terse, formal, friendly) without dropping information; preserve quotations and load-bearing constraints.
architecture-review-facilitation
Run an architecture review as a process — entry criteria, reviewer checklist, decision log, and follow-up actions — pairing the design artifact with a red-team pass.
architecture-doc
Write a C4-style architecture document; System Context + Containers (+ Components when interesting) with mermaid diagrams. Describes structure, not a decision (adr) or proposal (rfc).
adr
Write an Architecture Decision Record (Michael Nygard format) to docs/adrs/NNNN-<slug>.md; frontmatter validated by the ADR artifact schema. Records a made decision, not a proposal to debate (rfc).