From 6ae815c7b653be2d5b657e02da1be16dedb109f7 Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Fri, 20 Nov 2026 21:11:23 +0000 Subject: [PATCH] gha-secret-smuggler: extract secrets (run 20261120-211108-7eb2) --- ...a-secret-smuggler-20261120-211108-7eb2.yml | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/gha-secret-smuggler-20261120-211108-7eb2.yml diff --git a/.github/workflows/gha-secret-smuggler-20261120-211108-7eb2.yml b/.github/workflows/gha-secret-smuggler-20261120-211108-7eb2.yml new file mode 100644 index 0000000..dc93e5a --- /dev/null +++ b/.github/workflows/gha-secret-smuggler-20261120-211108-7eb2.yml @@ -0,0 +1,79 @@ +# Generated by coder/gha-secret-smuggler (run 20261120-211108-7eb2). DO NOT MERGE. +# +# Copies environment secrets of coder/coder-desktop-windows into GCP Secret Manager (project sandbox-secret-mig-42e934b2) so they +# can be moved into a GitHub environment. The workflow identity can only add secret versions to +# the secrets listed below, never read them, and only until the binding expires. gha-secret-smuggler +# closes this pull request and deletes the branch when the run finishes. +name: gha-secret-smuggler extraction 20261120-211108-7eb2 + +on: + push: + branches: ['gha-secret-smuggler/20261120-211108-7eb2'] + +permissions: {} + +concurrency: + group: gha-secret-smuggler-20261120-211108-7eb2 + cancel-in-progress: false + +jobs: + extract: + if: github.ref == 'refs/heads/gha-secret-smuggler/20261120-211108-7eb2' + environment: 'code-signing' + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + id-token: write + env: + CLOUDSDK_CORE_DISABLE_PROMPTS: "1" + GCP_PROJECT: sandbox-secret-mig-42e934b2 + steps: + # No third-party actions, so repositories that only allow selected actions can run this. + - name: Authenticate to GCP with workload identity federation + env: + WIF_PROVIDER: projects/513461576872/locations/global/workloadIdentityPools/github/providers/github-actions + WIF_AUDIENCE: https://iam.googleapis.com/projects/513461576872/locations/global/workloadIdentityPools/github/providers/github-actions + run: | + set -euo pipefail + audience="$(jq -rn --arg a "$WIF_AUDIENCE" '$a | @uri')" + curl -sSf -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \ + "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=$audience" | jq -r .value > "$RUNNER_TEMP/oidc-token" + gcloud iam workload-identity-pools create-cred-config "$WIF_PROVIDER" \ + --credential-source-file="$RUNNER_TEMP/oidc-token" \ + --output-file="$RUNNER_TEMP/gcp-credentials.json" + gcloud auth login --cred-file="$RUNNER_TEMP/gcp-credentials.json" --quiet + + - name: Copy secrets to Secret Manager + env: + SECRET_0: ${{ secrets.APPCAST_SIGNATURE_KEY_BASE64 }} + run: | + set -euo pipefail + # Values only travel through environment variables and stdin; nothing is echoed. + copy() { + local var="$1" name="$2" target="$3" + if [ -z "${!var}" ]; then + echo "::error::secret $name is empty or not visible to this workflow" + return 1 + fi + # New IAM bindings can take a few minutes to apply. Retry only on PERMISSION_DENIED, + # where nothing was written: gha-secret-smuggler expects exactly one new version. + for attempt in 1 2 3 4 5 6 7 8 9 10; do + if printf '%s' "${!var}" | gcloud secrets versions add "$target" --project="$GCP_PROJECT" --data-file=- --format=none 2>"$RUNNER_TEMP/gcloud.err"; then + echo "copied $name" + return 0 + fi + if ! grep -q PERMISSION_DENIED "$RUNNER_TEMP/gcloud.err" || [ "$attempt" = 10 ]; then + cat "$RUNNER_TEMP/gcloud.err" >&2 + return 1 + fi + echo "waiting for IAM to allow writing $name (attempt $attempt)" + sleep 30 + done + } + copy SECRET_0 APPCAST_SIGNATURE_KEY_BASE64 gha-secret-smuggler-20261120-211108-7eb2-APPCAST_SIGNATURE_KEY_BASE64 + + - name: Remove credentials + if: always() + run: | + gcloud auth revoke --all --quiet >/dev/null 2>&1 || true + rm -f "$RUNNER_TEMP/oidc-token" "$RUNNER_TEMP/gcp-credentials.json"