Skip to content

Commit 799a6d5

Browse files
chore: [StepSecurity] Harden GitHub Actions (#515)
1 parent 1e63fd0 commit 799a6d5

File tree

6 files changed

+54
-12
lines changed

6 files changed

+54
-12
lines changed

.github/workflows/conformance.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ jobs:
99
matrix:
1010
runtime: ['nodejs10', 'nodejs12', 'nodejs14', 'nodejs16']
1111
steps:
12+
- name: Harden Runner
13+
uses: step-security/harden-runner@18bf8ad2ca49c14cbb28b91346d626ccfb00c518 # v2.1.0
14+
with:
15+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
16+
1217
- name: Checkout code
13-
uses: actions/checkout@v3
18+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
1419

1520
- name: Use Node.js ${{ matrix.node-version }}
16-
uses: actions/setup-node@v3
21+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
1722
with:
1823
node-version: ${{ matrix.node-version }}
1924

@@ -25,7 +30,7 @@ jobs:
2530
run: npm install
2631

2732
- name: Install conformance client
28-
uses: GoogleCloudPlatform/functions-framework-conformance/.github/actions/client/[email protected]
33+
uses: GoogleCloudPlatform/functions-framework-conformance/.github/actions/client/install@42e1d91749b9c9d59fe405c254dc5de4b3b801ca # v1.7.0
2934
with:
3035
client-version: v1.7.0
3136
cache-path: ~/client

.github/workflows/docs.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@ on:
44
branches:
55
- master
66
pull_request:
7+
permissions:
8+
contents: read
9+
710
jobs:
811
docs:
912
runs-on: ubuntu-18.04
1013
steps:
11-
- uses: actions/checkout@v3
14+
- name: Harden Runner
15+
uses: step-security/harden-runner@18bf8ad2ca49c14cbb28b91346d626ccfb00c518 # v2.1.0
16+
with:
17+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
18+
19+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
1220
- name: Setup Node.js
13-
uses: actions/setup-node@v3
21+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
1422
with:
1523
node-version: '14'
1624
- name: Install dependencies

.github/workflows/lint.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@ on:
44
branches:
55
- master
66
pull_request:
7+
permissions:
8+
contents: read
9+
710
jobs:
811
lint:
912
runs-on: ubuntu-18.04
1013
steps:
11-
- uses: actions/checkout@v3
14+
- name: Harden Runner
15+
uses: step-security/harden-runner@18bf8ad2ca49c14cbb28b91346d626ccfb00c518 # v2.1.0
16+
with:
17+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
18+
19+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
1220
- name: Setup Node.js
13-
uses: actions/setup-node@v3
21+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
1422
- name: Install dependencies
1523
run: npm install
1624
- name: Build TypeScript project

.github/workflows/publish.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,25 @@ on:
33
types: [created]
44
workflow_dispatch:
55
name: publish
6+
permissions:
7+
contents: read
8+
69
jobs:
710
publish-to-npm:
811
runs-on: ubuntu-latest
912
steps:
10-
- uses: actions/checkout@v3
11-
- uses: actions/setup-node@v3
13+
- name: Harden Runner
14+
uses: step-security/harden-runner@18bf8ad2ca49c14cbb28b91346d626ccfb00c518 # v2.1.0
15+
with:
16+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
17+
18+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
19+
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
1220
with:
1321
node-version: '16.x'
1422
- run: npm install
1523
- run: npm run build
16-
- uses: actions/setup-node@v3
24+
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
1725
with:
1826
node-version: '16.x'
1927
registry-url: 'https://wombat-dressing-room.appspot.com'

.github/workflows/scorecard.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ jobs:
2424
id-token: write
2525

2626
steps:
27+
- name: Harden Runner
28+
uses: step-security/harden-runner@18bf8ad2ca49c14cbb28b91346d626ccfb00c518 # v2.1.0
29+
with:
30+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
31+
2732
- name: "Checkout code"
2833
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
2934
with:

.github/workflows/unit.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
branches:
55
- master
66
pull_request:
7+
permissions:
8+
contents: read
9+
710
jobs:
811
test:
912
strategy:
@@ -12,10 +15,15 @@ jobs:
1215
platform: [ubuntu-latest, macos-latest, windows-latest]
1316
runs-on: ${{ matrix.platform }}
1417
steps:
18+
- name: Harden Runner
19+
uses: step-security/harden-runner@18bf8ad2ca49c14cbb28b91346d626ccfb00c518 # v2.1.0
20+
with:
21+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
22+
1523
- name: Checkout
16-
uses: actions/checkout@v3
24+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
1725
- name: Use Node.js ${{ matrix.node-version }}
18-
uses: actions/setup-node@v3
26+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
1927
with:
2028
node-version: ${{ matrix.node-version }}
2129
- name: Install dependencies

0 commit comments

Comments
 (0)