Skip to content

sec(cli): the --yes flag skips the purchase confirmation on irreversible RI buys #1943

Closed

Description

@cristim

Summary

The CLI registers a --yes boolean flag that sets SkipConfirmation, and ConfirmPurchase returns true immediately when it is set, ahead of both the TTY check and the prompt. A single discoverable flag removes the only remaining human gate on a non-reversible, multi-thousand-dollar reserved-instance purchase. The project's standing rule is that the confirmation runs on every invocation. There is a TestDryRunFlagRemoved guard against reintroducing --dry-run, but nothing equivalent guards --yes.

Location

  • cmd/main.go:124 at 3c0f8ac
  • cmd/helpers.go:207-215 (the early return in ConfirmPurchase)

Failure scenario

An operator runs cudly --purchase --yes. ConfirmPurchase(..., skipConfirmation=true) returns true without printing the "About to purchase N instances" line and without reading stdin. The purchase proceeds unattended. The flag reaches exactly two call sites, the main purchase path at cmd/multi_service.go:158 and the CSV per-region prompt at cmd/multi_service.go:701. Dry runs are unaffected, since both sites sit behind a !isDryRun guard and dry runs never prompt.

Evidence

rootCmd.Flags().BoolVar(&toolCfg.SkipConfirmation, "yes", false, "Skip confirmation prompt for purchases (use with caution)")

Suggested fix

Remove the flag and the SkipConfirmation field, drop the parameter from ConfirmPurchase, and add a regression test asserting rootCmd.Flags().Lookup("yes") == nil alongside the existing TestDryRunFlagRemoved in cmd/effective_dry_run_test.go.


Found by the 2026-09-02 codebase audit, finding A10-005, reported by one reviewer and independently confirmed by a second. Full report: docs/audits/codebase-audit-2026-09-02.md.

Activity

  1. cristim commented on Sep 30, 2026

    @cristim
    MemberAuthor

    Post-merge verification passed on 911dc5da3f1a83c520395e1f8b1631cec2cebf9e from PR #2125.

    • The merged tree is 4f3aac010ff3067ab07e562c05e4a0d4cc26b4e0, identical to independently reviewed commit 2c6f21a00cab38b21baa748326f15b686a140b1d.
    • Fresh Go 1.26.6 focused race tests passed in 7.496s: removed-flag rejection, production nonterminal confirmation refusal, all-service normal coordinator, and the two-region CSV coordinator, including dry-run preservation.
    • Rebuilt the test overlay while checked out at the merged revision and drove both actual purchase coordinators through pseudo-terminals. For each coordinator, yes produced two successful local fake SDK purchases after one prompt; no produced zero. All four cases reported zero unexpected requests.

    These were local SDK fixtures with synthetic credentials and local network confinement, not real cloud purchases. No full-suite rerun or deployment was performed. Main-branch CI is monitored separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions