Skip to content

sec(gcp): close the mint-to-upload interrupt cleanup gap #2119

Description

@cristim

Problem

After #2112, cudly configure gcp still registers SIGINT/SIGTERM handling only after Step 5 returns. An interrupt after IAM creates the key but before upload can leave both the plaintext file and the active remote key behind.

Step 5 prints the temporary path before returning. A full stdout pipe blocks that print indefinitely. A second print after remote deletion also runs before local file removal, so it can block plaintext cleanup.

Reproduction

Run the actual runConfigureGCP coordinator in a subprocess with local IAM and Secrets Manager fixture endpoints. Fill stdout when the IAM create response arrives, wait for the fixture plaintext file, then send SIGINT or SIGTERM. The pre-fix coordinator exits and the key file remains. Merged commit c9d01f55dadee115926c5e00b807577c6e9784ab retains that coordinator code.

Expected behavior and fix

Activate signal cancellation after the final interactive choice, before key creation, and retain the same context through upload and cleanup. Remove output before cleanup completes. Preserve default interrupt behavior at blocking input prompts.

Scope: cmd/configure_gcp.go and real-coordinator subprocess regression tests. This addresses the signal lifecycle and stdout backpressure gap. The separate assertions, panic handling, and repeated-interrupt questions in #2117 remain tracked there.

Severity: medium. The interrupted setup leaves a long-lived credential that was intended to be removed.

References: #1947, #2112, #2117.

Activity

  1. cristim commented on Sep 29, 2026

    @cristim
    MemberAuthor

    Post-merge verification completed for PR #2120, merge commit 0229b938649433d0096ed2c5b60e6d89f5882ed1.

    • Fetched current main and checked out the actual merge commit. Its entire tree is identical to independently reviewed commit 42dcc9e5e2cb6fc737ab7a1ec3791040825ddd09: tree f7b2822efae9f06add8ecae99229cb1fc075a5fe; git diff --exit-code returned 0.
    • Fresh Go 1.26.6 run with GOWORK=off: go test -race -short ./cmd -run '^(TestRunConfigureGCP_Interrupt|TestUploadGCPCredentialsFile_|TestWriteServiceAccountKey_|TestGcloudDeleteKeyCommand)' -count=1 -timeout=120s passed in 11.518s.
    • The real coordinator subprocess tests verified SIGINT/SIGTERM cleanup with stdout full, cancellation during minting, and default interruption at the prompt. Cleanup tests also cover rollback, recovery errors, and preservation of operator-supplied files. These use local HTTP and filesystem fixtures; no live cloud operation was performed.

    The issue was auto-closed by the merged PR; this verification supports its completed status. The separate hardening work remains tracked in #2117. No additional follow-up issue was needed.

    Main CI runs 36542153810 and 36542153780 are tracked separately by the coordinator.

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