Skip to content

Commit

Permalink
chore(ci): pin 3rd party actions to sha commit (#1335)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Schueren authored Feb 27, 2023
1 parent 6b32304 commit 919853e
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/make-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v3
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
with:
path: "./node_modules"
# Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/measure-packages-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
with:
ref: ${{ steps.extract_PR_details.outputs.headSHA }}
- name: Packages size report
uses: flochaz/pkg-size-action@v2.0.0
uses: flochaz/pkg-size-action@e41584e9396375027c8a3c68909e3eca55719e47 # v.2.0.0
with:
build-command: mkdir dist && npm run package -w packages/logger -w packages/tracer -w packages/metrics -w packages/commons -w packages/parameters && npm run package-bundle -w packages/logger -w packages/tracer -w packages/metrics -w packages/commons -w packages/parameters && bash -c "mv ./packages/*/dist/* dist/" && ls dist
dist-directory: /dist
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on-merge-to-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
- name: Update release draft
uses: release-drafter/release-drafter@v5.20.0
uses: release-drafter/release-drafter@569eb7ee3a85817ab916c8f8ff03a5bd96c9c83e # v5.23.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release_label_on_merge:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/on-workflows-push-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lockdown untrusted workflows

on:
push:
paths:
- ".github/workflows/**"
pull_request:
paths:
- ".github/workflows/**"

jobs:
enforce_pinned_workflows:
name: Harden Security
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Ensure 3rd party workflows have SHA pinned
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@b9ddf6a5153efe6fb94f071c8915175afdce60fa # v2.1.0
with:
# Trusted GitHub Actions and/or organizations
allowlist: |
aws-actions/
actions/checkout
actions/github-script
actions/setup-node
actions/setup-python
actions/upload-artifact
actions/download-artifact
github/codeql-action/init
github/codeql-action/analyze
dependabot/fetch-metadata
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
echo "RELEASE_TAG_VERSION=${RELEASE_TAG_VERSION:1}" >> $GITHUB_ENV
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v3
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
with:
path: "./node_modules"
# Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
# if one of them changes the cache is invalidated/discarded
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v3
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
with:
path: "./node_modules"
key: 18-cache-utils-node-modules-${{ hashFiles('./package-lock.json') }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: npm i -g npm@next-8
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v3
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
with:
path: "./node_modules"
# Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
cache: "npm"
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v3
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
with:
path: "./examples/${{ matrix.example }}/node_modules"
# Use the combo between example, name, and SHA-256 hash of all example lock files as cache key.
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
cache: "npm"
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v3
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
with:
path: "./node_modules"
# Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
run: npm i -g npm@next-8
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v3
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
with:
path: "./node_modules"
# Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable_deploy_layer_stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- name: checkout
uses: actions/checkout@v3
- name: aws credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@186395a8644e48f35e7b453e8a7128d9a3948296
with:
aws-region: ${{ matrix.region }}
role-to-assume: ${{ secrets.target-account-role }}
Expand All @@ -72,7 +72,7 @@ jobs:
node-version: "18"
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v3
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
with:
path: "./node_modules"
# Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
# See https://github.com/npm/cli/issues/4475 to see why --foreground-scripts
run: npm ci --foreground-scripts
- name: Setup AWS credentials
uses: aws-actions/configure-aws-credentials@v1.6.1
uses: aws-actions/configure-aws-credentials@186395a8644e48f35e7b453e8a7128d9a3948296
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
aws-region: eu-west-1
Expand Down Expand Up @@ -98,13 +98,13 @@ jobs:
- name: Setup npm
run: npm i -g npm@next-8
- name: "Configure AWS credentials"
uses: aws-actions/configure-aws-credentials@v1.6.1
uses: aws-actions/configure-aws-credentials@186395a8644e48f35e7b453e8a7128d9a3948296
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
aws-region: eu-west-1
- name: Cache node modules for commons
id: cache-node-modules
uses: actions/cache@v3
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
with:
path: "./node_modules"
# Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that
Expand Down

0 comments on commit 919853e

Please sign in to comment.