From b713dbe66903799878d807ad6064e644f00358ee Mon Sep 17 00:00:00 2001 From: rob thijssen Date: Mon, 18 May 2026 17:13:52 +0300 Subject: [PATCH] fix(ci): pass GPG secrets via env to avoid Gitea log leakage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous "Import signing key" step inlined ${{ secrets.RPM_SIGNING_KEY }} and ${{ secrets.RPM_SIGNING_KEY_ID }} directly into the run: block. Template expansion writes the literal secret value into the rendered shell script, and Gitea logs the rendered script — Gitea's masker may not reliably scrub multi-line keys, so values can leak. Move both secrets into the step's env: block (the same pattern the "Set up SSH" step already uses) and reference $VARs in the script. The script body now contains only variable names; the secret values live in the process environment. Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitea/workflows/build-prerelease.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/build-prerelease.yml b/.gitea/workflows/build-prerelease.yml index dda4110..5571098 100644 --- a/.gitea/workflows/build-prerelease.yml +++ b/.gitea/workflows/build-prerelease.yml @@ -265,11 +265,19 @@ jobs: fi - name: Import signing key + env: + # Pass secrets via env so values stay out of the rendered shell + # script (which Gitea includes in step logs). Template + # expansion of ${{ secrets.X }} inside `run:` writes the literal + # value into the script and depends on Gitea's log masker to + # scrub it — fragile for multi-line keys. + RPM_SIGNING_KEY: ${{ secrets.RPM_SIGNING_KEY }} + RPM_SIGNING_KEY_ID: ${{ secrets.RPM_SIGNING_KEY_ID }} run: | - echo "${{ secrets.RPM_SIGNING_KEY }}" | gpg --batch --import - fpr=$(gpg --batch --with-colons --list-keys "${{ secrets.RPM_SIGNING_KEY_ID }}" | awk -F: '/^fpr:/ { print $10; exit }') + echo "$RPM_SIGNING_KEY" | gpg --batch --import + fpr=$(gpg --batch --with-colons --list-keys "$RPM_SIGNING_KEY_ID" | awk -F: '/^fpr:/ { print $10; exit }') echo "${fpr}:6:" | gpg --batch --import-ownertrust - sed "s/@GPG_NAME@/${{ secrets.RPM_SIGNING_KEY_ID }}/" rpm/rpmmacros > ~/.rpmmacros + sed "s/@GPG_NAME@/$RPM_SIGNING_KEY_ID/" rpm/rpmmacros > ~/.rpmmacros - name: Sign RPMs run: |