Skip to content

Commit 02dfeb4

Browse files
chore: [StepSecurity] Harden GitHub Actions (#150)
1 parent e1458ec commit 02dfeb4

File tree

5 files changed

+43
-12
lines changed

5 files changed

+43
-12
lines changed

.github/workflows/conformance.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,38 @@ jobs:
1414
matrix:
1515
ruby-version: ["2.6", "2.7", "3.0", "3.1", "3.2"]
1616
steps:
17+
- name: Harden Runner
18+
uses: step-security/harden-runner@18bf8ad2ca49c14cbb28b91346d626ccfb00c518 # v2.1.0
19+
with:
20+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
21+
1722
- name: Checkout code
18-
uses: actions/checkout@v3
23+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
1924
- name: Setup Go
20-
uses: actions/setup-go@v3
25+
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
2126
with:
2227
go-version: '1.17'
2328
check-latest: true
2429
- name: Setup Ruby
25-
uses: ruby/setup-ruby@v1
30+
uses: ruby/setup-ruby@4d060a10e6d98429c69057f0aafbc65fb982bae8 # v1.137.0
2631
with:
2732
ruby-version: ${{ matrix.ruby-version }}
2833
bundler-cache: true
2934
- name: Run HTTP conformance tests
30-
uses: GoogleCloudPlatform/functions-framework-conformance/[email protected]
35+
uses: GoogleCloudPlatform/functions-framework-conformance/action@c52662e612b2685a027b1c3e02224306517722fc # v1.6.0
3136
with:
3237
functionType: 'http'
3338
useBuildpacks: false
3439
cmd: "'bundle exec functions-framework-ruby --source test/conformance/app.rb --target http_func --signature-type http'"
3540
- name: Run CloudEvent conformance tests
36-
uses: GoogleCloudPlatform/functions-framework-conformance/[email protected]
41+
uses: GoogleCloudPlatform/functions-framework-conformance/action@c52662e612b2685a027b1c3e02224306517722fc # v1.6.0
3742
with:
3843
functionType: 'cloudevent'
3944
useBuildpacks: false
4045
validateMapping: true
4146
cmd: "'bundle exec functions-framework-ruby --source test/conformance/app.rb --target cloudevent_func --signature-type cloudevent'"
4247
- name: Run HTTP concurrency tests
43-
uses: GoogleCloudPlatform/functions-framework-conformance/[email protected]
48+
uses: GoogleCloudPlatform/functions-framework-conformance/action@c52662e612b2685a027b1c3e02224306517722fc # v1.6.0
4449
with:
4550
functionType: 'http'
4651
useBuildpacks: false

.github/workflows/lint.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,23 @@ on:
77
branches:
88
- main
99
workflow_dispatch:
10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
lint:
1215
if: ${{ github.repository == 'GoogleCloudPlatform/functions-framework-ruby' }}
1316
runs-on: ubuntu-latest
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 repo
16-
uses: actions/checkout@v3
24+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
1725
- name: Install Ruby 3.0
18-
uses: ruby/setup-ruby@v1
26+
uses: ruby/setup-ruby@4d060a10e6d98429c69057f0aafbc65fb982bae8 # v1.137.0
1927
with:
2028
ruby-version: "3.0"
2129
bundler-cache: true

.github/workflows/push-gh-pages.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@ jobs:
1010
ruby_version: "3.0"
1111
runs-on: ubuntu-latest
1212
steps:
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+
1318
- name: Checkout repo
14-
uses: actions/checkout@v3
19+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
1520
- name: Install Ruby ${{ env.ruby_version }}
16-
uses: ruby/setup-ruby@v1
21+
uses: ruby/setup-ruby@4d060a10e6d98429c69057f0aafbc65fb982bae8 # v1.137.0
1722
with:
1823
ruby-version: ${{ env.ruby_version }}
1924
bundler-cache: true

.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
@@ -7,6 +7,9 @@ on:
77
branches:
88
- main
99
workflow_dispatch:
10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
unit-test:
1215
if: ${{ github.repository == 'GoogleCloudPlatform/functions-framework-ruby' }}
@@ -46,10 +49,15 @@ jobs:
4649
fail-fast: false
4750
runs-on: ${{ matrix.os }}
4851
steps:
52+
- name: Harden Runner
53+
uses: step-security/harden-runner@18bf8ad2ca49c14cbb28b91346d626ccfb00c518 # v2.1.0
54+
with:
55+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
56+
4957
- name: Checkout repo
50-
uses: actions/checkout@v3
58+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
5159
- name: Install Ruby ${{ matrix.ruby }}
52-
uses: ruby/setup-ruby@v1
60+
uses: ruby/setup-ruby@4d060a10e6d98429c69057f0aafbc65fb982bae8 # v1.137.0
5361
with:
5462
ruby-version: "${{ matrix.ruby }}"
5563
bundler-cache: true

0 commit comments

Comments
 (0)