Move kubectl unbounded site add-machine to kubectl unbounded machine register#15
Conversation
Rename siteAddMachineHandler → machineCreateHandler and siteAddMachineCommand → machineCreateCommand. Move the command registration from cmd_site.go to cmd_machine.go. Update all documentation, tests, and the architecture SVG. Agent-Logs-Url: https://github.com/Azure/unbounded-kube/sessions/ab4d5170-33f1-48ad-b635-1980f8efb239 Co-authored-by: jveski <7576912+jveski@users.noreply.github.com>
|
Wonder if |
IMO create generically implies that a k8s object will be created like @copilot Go ahead and make the change 🚀 |
Should also consider the removal side too.
|
|
Per review feedback, `register` better describes the intent of the command since it registers an existing machine rather than creating one from scratch. Agent-Logs-Url: https://github.com/Azure/unbounded-kube/sessions/bb29a5cd-f364-403c-8130-d925380eeb97 Co-authored-by: jveski <7576912+jveski@users.noreply.github.com>
Done in a888391 — renamed |
kubectl unbounded site add-machine to kubectl unbounded machine createkubectl unbounded site add-machine to kubectl unbounded machine register
|
@copilot rebase please |
…d-site-add-machine # Conflicts: # README.md Co-authored-by: jveski <7576912+jveski@users.noreply.github.com>
GHAS / CodeQL flagged two "Incorrect conversion between integer types" findings on the awss3 and azureblob origin adapters: the List call sites cast a host-int maxResults to int32 without an upper-bound check, so an untrusted caller passing ?max-keys=99999999999 would silently overflow MaxKeys/MaxResults to a non-deterministic (often negative) int32 value before it reached the SDK. The server-side parse (server.go:704-711) only guards v > 0; the > int32 max case slipped through. Per-adapter clamp instead of a server-side ceiling so each backend keeps its own documented max: - awss3.clampMaxKeys: 0..1000 (S3 ListObjectsV2 server-side cap) - azureblob.clampMaxResults: 0..5000 (Azure ListBlobs server-side cap) A server-wide cap would have artificially limited Azure callers to the smaller of the two ceilings; clamping per-adapter keeps the backends' native quotas reachable while making the int32 conversion locally provable. Negative inputs collapse to 0 (which the backends interpret as "use default") so the symmetric overflow window is also closed. Tests: TestClampMaxKeys and TestClampMaxResults table-drive every boundary (zero, small positive, exact cap, cap+1, math.MaxInt32, math.MaxInt, -1, math.MinInt). Both run as fast unit tests with no SDK or network seam needed. Resolves https://github.com/Azure/unbounded/security/code-scanning/14 Resolves https://github.com/Azure/unbounded/security/code-scanning/15
GHAS / CodeQL flagged two "Incorrect conversion between integer types" findings on the awss3 and azureblob origin adapters: the List call sites cast a host-int maxResults to int32 without an upper-bound check, so an untrusted caller passing ?max-keys=99999999999 would silently overflow MaxKeys/MaxResults to a non-deterministic (often negative) int32 value before it reached the SDK. The server-side parse (server.go:704-711) only guards v > 0; the > int32 max case slipped through. Per-adapter clamp instead of a server-side ceiling so each backend keeps its own documented max: - awss3.clampMaxKeys: 0..1000 (S3 ListObjectsV2 server-side cap) - azureblob.clampMaxResults: 0..5000 (Azure ListBlobs server-side cap) A server-wide cap would have artificially limited Azure callers to the smaller of the two ceilings; clamping per-adapter keeps the backends' native quotas reachable while making the int32 conversion locally provable. Negative inputs collapse to 0 (which the backends interpret as "use default") so the symmetric overflow window is also closed. Tests: TestClampMaxKeys and TestClampMaxResults table-drive every boundary (zero, small positive, exact cap, cap+1, math.MaxInt32, math.MaxInt, -1, math.MinInt). Both run as fast unit tests with no SDK or network seam needed. Resolves https://github.com/Azure/unbounded/security/code-scanning/14 Resolves https://github.com/Azure/unbounded/security/code-scanning/15
Summary
Moves the
site add-machinesubcommand from thesitecommand group to themachinecommand group asmachine register. This better aligns the command hierarchy—machine lifecycle operations (register,reboot,reimage,manual-bootstrap) are now all underkubectl unbounded machine.Changes
Go source
site_add_machine.go→machine_register.gositeAddMachineHandler→machineRegisterHandlersiteAddMachineCommand()→machineRegisterCommand()Usechanged from"add-machine"to"register"Shortupdated to"Register a machine to the site"site_add_machine_test.go→machine_register_test.goTestSiteAddMachine…→TestMachineRegister…)"register"instead of"add-machine"cmd_site.go: RemovedsiteAddMachineCommand()from site subcommandscmd_machine.go: AddedmachineRegisterCommand()to machine subcommandsDocumentation
machinecommand group header, updated all examplesTesting
go build ./cmd/kubectl-unbounded/...✅go test ./cmd/kubectl-unbounded/...✅ (all tests pass)