Skip to content

Commit 3b1be53

Browse files
committed
tighten CI secret scope and move AWS config to environment vars
* Add `environment: release` to the "publish-to-hex" job so that only workflows explicitly targeting the release environment can read sensitive values. * Gate the job behind `if: ${{ vars.HEX_AWS_REGION }}` to avoid noisy failures in forks where the variable is not configured. * Replace `${{ secrets.HEX_AWS_REGION }}` / `${{ secrets.HEX_AWS_S3_BUCKET }}` references with `${{ vars.* }}`. These are not credentials, so environment-level *variables* are a better fit and keep them readable only by jobs that declare the environment. * Remove Fastly secrets from the job-wide `env:` block and inject them only into the Fastly purge step, following the principle of least privilege. Other steps no longer see these tokens. Restricting secret visibility to an environment and to the exact step that needs them reduces the blast radius of a compromised workflow run, blocks accidental exposure in logs of unrelated steps, and stops forks from obtaining privileged data.
1 parent 57c254f commit 3b1be53

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,14 @@ jobs:
303303
needs: [build, sign]
304304
runs-on: ubuntu-22.04
305305
concurrency: builds-hex-pm
306+
environment: release
307+
# Only run if HEX_AWS_REGION is set (no failing job in forks)
308+
if: "${{ vars.HEX_AWS_REGION }}"
306309
env:
307310
AWS_ACCESS_KEY_ID: ${{ secrets.HEX_AWS_ACCESS_KEY_ID }}
308311
AWS_SECRET_ACCESS_KEY: ${{ secrets.HEX_AWS_SECRET_ACCESS_KEY }}
309-
AWS_REGION: ${{ secrets.HEX_AWS_REGION }}
310-
AWS_S3_BUCKET: ${{ secrets.HEX_AWS_S3_BUCKET }}
311-
FASTLY_REPO_SERVICE_ID: ${{ secrets.HEX_FASTLY_REPO_SERVICE_ID }}
312-
FASTLY_BUILDS_SERVICE_ID: ${{ secrets.HEX_FASTLY_BUILDS_SERVICE_ID }}
313-
FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }}
312+
AWS_REGION: ${{ vars.HEX_AWS_REGION }}
313+
AWS_S3_BUCKET: ${{ vars.HEX_AWS_S3_BUCKET }}
314314
OTP_GENERIC_VERSION: "25"
315315
steps:
316316
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
@@ -417,3 +417,7 @@ jobs:
417417
for key in $(cat purge_keys.txt); do
418418
purge "${key}"
419419
done
420+
env:
421+
FASTLY_REPO_SERVICE_ID: ${{ secrets.HEX_FASTLY_REPO_SERVICE_ID }}
422+
FASTLY_BUILDS_SERVICE_ID: ${{ secrets.HEX_FASTLY_BUILDS_SERVICE_ID }}
423+
FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }}

0 commit comments

Comments
 (0)