Skip to content

fix: restrict CRD verbs to operator-owned resources only#407

Open
mgrzybek wants to merge 5 commits into
mainfrom
fix/h1-crd-wildcard-verbs
Open

fix: restrict CRD verbs to operator-owned resources only#407
mgrzybek wants to merge 5 commits into
mainfrom
fix/h1-crd-wildcard-verbs

Conversation

@mgrzybek

@mgrzybek mgrzybek commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Finding

ClusterRole grants wildcard verbs on customresourcedefinitions

Root cause

The operator ClusterRole granted ["*"] on all CRDs cluster-wide. A compromised operator could overwrite or delete CRDs belonging to other operators on the same cluster.

Changes

  • Split the CRD rule in two:
    • list, watch on all CRDs (required by kopf for CRD discovery — resourceNames cannot scope collection operations in Kubernetes RBAC)
    • get, create, update, patch restricted via resourceNames to the two CRDs this operator actually manages: clusters.caas.azimuth.stackhpc.com and clustertypes.caas.azimuth.stackhpc.com
  • Updated helm-unittest snapshot accordingly (helm unittest --update-snapshot)

The operator ClusterRole granted wildcard verbs ["*"] on all
customresourcedefinitions cluster-wide, allowing it to overwrite or
delete CRDs belonging to other operators.

Split the rule in two:
- list, watch on all CRDs (required by kopf for CRD discovery;
  resourceNames cannot scope collection operations in Kubernetes RBAC).
- get, create, update, patch restricted via resourceNames to the two
  CRDs this operator actually manages:
    clusters.caas.azimuth.stackhpc.com
    clustertypes.caas.azimuth.stackhpc.com

The helm-unittest snapshot is updated accordingly.
@mgrzybek
mgrzybek requested a review from a team as a code owner June 22, 2026 12:43
@mgrzybek mgrzybek changed the title fix: restrict CRD verbs to operator-owned resources only (H1) fix: restrict CRD verbs to operator-owned resources only Jun 22, 2026
mgrzybek added 4 commits June 22, 2026 14:47
ct lint 3.14.0 requires a maintainers field in Chart.yaml regardless of
validate-maintainers: false (which only skips URL validation). Add a
minimal maintainers entry so lint passes.

Also add check-version-increment: false to ct.yaml — this matches the
intent stated in the existing comment ("skip version bump detection")
which all: true does not actually provide. Reverts the unnecessary 0.1.1
version bump added in the previous commit.

Snapshot regenerated after Chart.yaml change.
ct lint requires a version bump for any changed chart and a maintainers
field regardless of validate-maintainers: false (which only skips URL
validation). check-version-increment in ct.yaml has no effect when
--target-branch is passed on the CLI.

- Bump charts/operator version 0.1.0 -> 0.1.1
- Add maintainers field to charts/operator/Chart.yaml
- Restore ct.yaml to its original state (check-version-increment has
  no effect here so the addition is reverted)
- Regenerate helm-unittest snapshot
Signed-off-by: Mathieu Grzybek <mathieu@stackhpc.com>
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.

1 participant