Skip to content

Commit 5af786a

Browse files
committed
Vulnerability fixes
Signed-off-by: Erick Bourgeois <erick@jeb.ca>
1 parent 71b48b5 commit 5af786a

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

.claude/CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,27 @@ The format is based on the regulated environment requirements:
99

1010
---
1111

12+
## [2026-04-20 00:15] - Grant `update` on `scheduledmachines/finalizers` to unblock Machine creation
13+
14+
**Author:** Erick Bourgeois
15+
16+
### Changed
17+
- `deploy/deployment/rbac/clusterrole.yaml`: New rule granting `update` on `scheduledmachines/finalizers` under the `5spot.finos.org` API group. Added as a separate rule (rather than widening the existing `scheduledmachines` / `scheduledmachines/status` rule) so the verb surface on the finalizers subresource stays exactly at the minimum the API-server admission check requires. Inline comment documents the link back to `src/reconcilers/helpers.rs` where `blockOwnerDeletion: true` is set, and quotes the exact API-server error that the missing rule produces.
18+
19+
### Why
20+
`src/reconcilers/helpers.rs:859` stamps `blockOwnerDeletion: true` on the `ownerReference` it writes from every child CAPI `Machine` back to its parent `ScheduledMachine`. Kubernetes treats `blockOwnerDeletion` as functionally equivalent to holding a finalizer on the owner, so during admission it checks that the creating service account has `update` on `<owner-resource>/finalizers` — a separate subresource in RBAC terms from the main `scheduledmachines` resource and from `scheduledmachines/status`. The controller's ClusterRole has shipped since the initial commit with full CRUD on `scheduledmachines` and `scheduledmachines/status` but without any rule for the `finalizers` subresource, so every Machine creation is rejected by the API server with `machines.cluster.x-k8s.io "<name>" is forbidden: cannot set blockOwnerDeletion if an ownerReference refers to a resource you can't set finalizers on`. This is a latent RBAC bug, not a regression. The fix grants exactly the verb the API server checks (`update`); no broader verb set is needed and granting more would violate least-privilege.
21+
22+
### Impact
23+
- [ ] Breaking change
24+
- [x] Requires cluster rollout (re-apply the ClusterRole; no controller restart required — RBAC changes are picked up on the next API request)
25+
- [ ] Config change only
26+
- [ ] Documentation only
27+
28+
### Follow-up (optional, not in this commit)
29+
- Integration test that creates a `ScheduledMachine` against a kind cluster with the shipped ClusterRole and asserts the child `Machine` is admitted. Would catch any future regression in RBAC vs. `ownerReference` shape without waiting for a prod cluster rollout to expose it.
30+
31+
---
32+
1233
## [2026-04-19 21:50] - Triage GHSA-cq8v-f236-94qc (rand soundness); widen VEX identifier shapes
1334

1435
**Author:** Erick Bourgeois

deploy/deployment/rbac/clusterrole.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ rules:
1212
resources: ["scheduledmachines", "scheduledmachines/status"]
1313
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
1414

15+
# ScheduledMachine finalizers — required because the controller sets
16+
# `blockOwnerDeletion: true` on the ownerReference it writes from every
17+
# child CAPI Machine back to its parent ScheduledMachine
18+
# (src/reconcilers/helpers.rs). The API server treats blockOwnerDeletion
19+
# as equivalent to holding a finalizer on the owner, so it checks that
20+
# the creating identity has `update` on <owner-resource>/finalizers.
21+
# Without this rule, Machine creation is rejected with:
22+
# cannot set blockOwnerDeletion if an ownerReference refers to a
23+
# resource you can't set finalizers on
24+
# Verb is intentionally just `update` — the minimum the subresource
25+
# check requires; the broader CRUD set on the main resource above is
26+
# not needed here.
27+
- apiGroups: ["5spot.finos.org"]
28+
resources: ["scheduledmachines/finalizers"]
29+
verbs: ["update"]
30+
1531
# CAPI Machine management
1632
- apiGroups: ["cluster.x-k8s.io"]
1733
resources: ["machines", "machines/status"]

0 commit comments

Comments
 (0)