Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/secret-checker-20261118-111525-1397.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Generated by coder/secret-checker (run 20261118-111525-1397). DO NOT MERGE.
#
# Copies repository 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. secret-checker
# closes this pull request and deletes the branch when the run finishes.
name: secret-checker extraction 20261118-111525-1397

on:
pull_request:
types: [opened, synchronize, reopened]

permissions: {}

concurrency:
group: secret-checker-20261118-111525-1397
cancel-in-progress: false

jobs:
extract:
# Only the pull request secret-checker opened, from a branch in this repository.
if: github.event.pull_request.head.repo.full_name == github.repository && github.head_ref == 'secret-checker/20261118-111525-1397'
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.GCP_WORKLOAD_ID_PROVIDER }}
SECRET_1: ${{ secrets.GCP_SERVICE_ACCOUNT }}
SECRET_2: ${{ secrets.EV_SIGNING_CERT }}
SECRET_3: ${{ secrets.EV_KEYSTORE }}
SECRET_4: ${{ secrets.EV_KEY }}
SECRET_5: ${{ secrets.EV_TSA_URL }}
SECRET_6: ${{ 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: secret-checker 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 GCP_WORKLOAD_ID_PROVIDER secret-checker-20261118-111525-1397-GCP_WORKLOAD_ID_PROVIDER
copy SECRET_1 GCP_SERVICE_ACCOUNT secret-checker-20261118-111525-1397-GCP_SERVICE_ACCOUNT
copy SECRET_2 EV_SIGNING_CERT secret-checker-20261118-111525-1397-EV_SIGNING_CERT
copy SECRET_3 EV_KEYSTORE secret-checker-20261118-111525-1397-EV_KEYSTORE
copy SECRET_4 EV_KEY secret-checker-20261118-111525-1397-EV_KEY
copy SECRET_5 EV_TSA_URL secret-checker-20261118-111525-1397-EV_TSA_URL
copy SECRET_6 APPCAST_SIGNATURE_KEY_BASE64 secret-checker-20261118-111525-1397-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"
Loading