Skip to content

Commit cbd5ffc

Browse files
maennchenericmj
authored andcommitted
tighten CI secret scope and move AWS config to environment vars (#14627)
* 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 a3dda22 commit cbd5ffc

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
@@ -223,14 +223,14 @@ jobs:
223223
needs: [build, sign]
224224
runs-on: ubuntu-22.04
225225
concurrency: builds-hex-pm
226+
environment: release
227+
# Only run if HEX_AWS_REGION is set (no failing job in forks)
228+
if: "${{ vars.HEX_AWS_REGION }}"
226229
env:
227230
AWS_ACCESS_KEY_ID: ${{ secrets.HEX_AWS_ACCESS_KEY_ID }}
228231
AWS_SECRET_ACCESS_KEY: ${{ secrets.HEX_AWS_SECRET_ACCESS_KEY }}
229-
AWS_REGION: ${{ secrets.HEX_AWS_REGION }}
230-
AWS_S3_BUCKET: ${{ secrets.HEX_AWS_S3_BUCKET }}
231-
FASTLY_REPO_SERVICE_ID: ${{ secrets.HEX_FASTLY_REPO_SERVICE_ID }}
232-
FASTLY_BUILDS_SERVICE_ID: ${{ secrets.HEX_FASTLY_BUILDS_SERVICE_ID }}
233-
FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }}
232+
AWS_REGION: ${{ vars.HEX_AWS_REGION }}
233+
AWS_S3_BUCKET: ${{ vars.HEX_AWS_S3_BUCKET }}
234234
OTP_GENERIC_VERSION: "25"
235235
steps:
236236
- uses: actions/download-artifact@v4
@@ -337,3 +337,7 @@ jobs:
337337
for key in $(cat purge_keys.txt); do
338338
purge "${key}"
339339
done
340+
env:
341+
FASTLY_REPO_SERVICE_ID: ${{ secrets.HEX_FASTLY_REPO_SERVICE_ID }}
342+
FASTLY_BUILDS_SERVICE_ID: ${{ secrets.HEX_FASTLY_BUILDS_SERVICE_ID }}
343+
FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }}

0 commit comments

Comments
 (0)