Skip to content

fix(spur-cli): reject unresolved k8s callers - #609

Open
joshkmartinez wants to merge 2 commits into
ROCm:mainfrom
joshkmartinez:fix/k8s-unresolved-callers
Open

fix(spur-cli): reject unresolved k8s callers#609
joshkmartinez wants to merge 2 commits into
ROCm:mainfrom
joshkmartinez:fix/k8s-unresolved-callers

Conversation

@joshkmartinez

Copy link
Copy Markdown
Contributor

Closes #603.

spur k8s up, down, and kubeconfig used unknown when the local username could not be resolved. The controller rejects that caller, but the CLI still sent an ambiguous identity.

These commands now reuse the existing fail-closed username resolver and return its error before dispatching an RPC. status and the local install-k0s command do not perform a username lookup.

Testing

  • 14 focused k8s command tests, including controller-backed caller and no-dispatch checks
  • full spur-cli test suite: 360 unit tests and 1 integration test
  • cargo clippy -p spur-cli --all-targets --locked -- -D warnings
  • formatting, SPDX, and diff checks

The spur-cli checks required a temporary macOS-only compile shim for the pre-existing nix::unistd::getgroups failure on Apple targets. The shim was reverted and is not part of this PR. The repository-wide run then reached the existing Linux-only spur-mpi-pmix linker boundary.

@joshkmartinez
joshkmartinez marked this pull request as ready for review August 11, 2026 02:45
Copilot AI lite review requested due to automatic review settings August 11, 2026 02:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates spur-cli’s k8s subcommands to fail closed when the local username cannot be resolved, preventing ambiguous "unknown" caller identities from being sent to the controller (which rejects them anyway). This aligns the k8s CLI path with the existing caller-resolution behavior used elsewhere in spur-cli.

Changes:

  • Route spur k8s up|down|kubeconfig through the shared fail-closed username resolver and error out before dispatching any RPC when resolution fails.
  • Extend the in-process mock controller harness to implement and record the k8s RPCs needed by CLI tests.
  • Add targeted tests covering “no-dispatch on user resolution failure”, “resolved caller is forwarded”, and “unauthenticated commands don’t resolve user”.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/spur-cli/src/k8s.rs Replaces "unknown" fallback with fail-closed caller resolution for authenticated k8s commands and adds focused tests.
crates/spur-cli/src/mock_controller.rs Implements mock k8s RPC endpoints and captures requests for assertions in CLI tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 111 to 113
} => {
let caller = current_user()?;
cmd_up(
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.

fix(spur-cli): reject unresolved k8s callers

2 participants