[1/3] Restrict Flex Node bootstrap token RBAC - #287
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens the security posture of Flex Node bootstrap tokens by removing the legacy RBAC privilege-escalation path (bootstrapper group → system:node) and introducing an explicit, fail-closed migration flow that preserves ambiguous/customized operator RBAC for manual review.
Changes:
- Replaces “apply a static RBAC manifest” with reconciliation that only manages least-privilege CSR create/auto-approve bindings and verifies postconditions.
- Adds an explicit
--remove-legacy-node-role-bindingmigration that only auto-deletes the canonical legacy binding using UID/resourceVersion preconditions, and refuses to mint new bootstrap tokens while any unsafe binding remains. - Adds regression coverage for reconciliation + migration semantics, and updates docs/E2E fixtures to align with the restricted bootstrap RBAC model.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/aks-flex-config | Implements RBAC reconciliation, explicit legacy-binding migration with preconditions, and fail-closed bootstrap token generation when unsafe bindings remain. |
| scripts/aks_flex_config_test.go | Adds comprehensive regression tests for safe RBAC reconciliation, migration behavior, concurrency preconditions, and repository-wide invariants. |
| hack/e2e/lib/node-join-kubeadm.sh | Removes legacy system:node binding from the kubeadm E2E fixture and adds basic error handling for RBAC/ConfigMap applies; tightens config file permissions. |
| docs/usages/joining-nodes.md | Updates bootstrap-token flow to reflect least-privilege RBAC and explicit migration requirements. |
| docs/usages/aks-flex-config.md | Documents the explicit migration, certificate verification steps, and rollback considerations for removing the obsolete legacy binding. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
scripts/aks-flex-config:412
- The kubectl-proxy readiness detector only searches for the "Starting to serve on …" line in stdout. If kubectl emits this line on stderr (common for long-running command logging), this will always time out and prevent conditional deletion. Consider matching the readiness pattern in both streams.
if key.data == "stdout" and startup_pattern.search(stream_output):
Summary
system:nodeprivilege escalation pathClusterRoleBindingand namespacedRoleBindingedgesWhy this PR is focused
This is part 1 of the replacement for #286. It contains only the shipped RBAC behavior, its operator documentation, and direct regression coverage.
Stack:
Safety properties
system:bootstrappersandsystem:bootstrappers:aks-flex-node; unrelated bootstrap subgroups are not swept in.Validation
make checkgo test -race ./scriptsbash -nfor the changed E2E fixturee7d517de7d517d, including cleanup790f408, including evidence upload, cleanup, and cleanup diagnosticsDeliberately deferred low-risk scope
This helper audits direct bootstrap-group-to-
system:nodebindings, not arbitrary custom or aggregated-role effective authorization. Proxy pipe buffering, longTMPDIRUnix-socket paths, and DELETE 404 races fail closed or have low practical exposure and are left for follow-up rather than expanding this security PR.