Skip to content

Commit 9f47cb3

Browse files
authored
Merge pull request #232 from 1Password/chore/GHA-142344-stepsecurity-remediation
Apply GitHub Actions security best practices
2 parents cc14595 + db42c1d commit 9f47cb3

4 files changed

Lines changed: 50 additions & 8 deletions

File tree

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
cooldown:
8+
default-days: 7

.github/workflows/check-signed-commits.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Check signed commits in PR
22
on: pull_request_target
33

4+
permissions:
5+
contents: read
6+
47
jobs:
58
build:
69
name: Check signed commits in PR
@@ -9,5 +12,10 @@ jobs:
912
pull-requests: write
1013
runs-on: ubuntu-latest
1114
steps:
15+
- name: Harden the runner (Audit all outbound calls)
16+
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
17+
with:
18+
egress-policy: audit
19+
1220
- name: Check signed commits in PR
1321
uses: 1Password/check-signed-commits-action@main

.github/workflows/ok-to-test.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
issue_comment:
66
types: [created]
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
ok-to-test:
1013
runs-on: ubuntu-latest
@@ -14,8 +17,13 @@ jobs:
1417
# Only run for PRs, not issue comments
1518
if: ${{ github.event.issue.pull_request }}
1619
steps:
20+
- name: Harden the runner (Audit all outbound calls)
21+
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
22+
with:
23+
egress-policy: audit
24+
1725
- name: Slash Command Dispatch
18-
uses: peter-evans/slash-command-dispatch@v3
26+
uses: peter-evans/slash-command-dispatch@f996d7b7aae9059759ac55e978cff76d91853301 # v3.0.2
1927
with:
2028
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
2129
reaction-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/validate.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
repository_dispatch:
1212
types: [ ok-to-test-command ]
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518

1619
test-trusted:
@@ -22,9 +25,14 @@ jobs:
2225
python-version: ["3.10", "3.11", "3.12", "3.13"]
2326
runs-on: ${{ matrix.os }}
2427
steps:
25-
- uses: actions/checkout@v3
28+
- name: Harden the runner (Audit all outbound calls)
29+
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
30+
with:
31+
egress-policy: audit
32+
33+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
2634
- name: Set up Python
27-
uses: actions/setup-python@v4
35+
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
2836
with:
2937
python-version: ${{ matrix.python-version }}
3038
- name: Integration Test
@@ -48,10 +56,15 @@ jobs:
4856
name: Lint
4957
runs-on: ubuntu-latest
5058
steps:
51-
- uses: actions/checkout@v3
59+
- name: Harden the runner (Audit all outbound calls)
60+
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
61+
with:
62+
egress-policy: audit
63+
64+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
5265

5366
- name: Set up Python
54-
uses: actions/setup-python@v4
67+
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
5568
with:
5669
python-version: '3.x'
5770

@@ -83,13 +96,18 @@ jobs:
8396
steps:
8497

8598
# Check out merge commit
99+
- name: Harden the runner (Audit all outbound calls)
100+
uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
101+
with:
102+
egress-policy: audit
103+
86104
- name: Fork based /ok-to-test checkout
87-
uses: actions/checkout@v4
105+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
88106
with:
89107
ref: ${{ github.event.client_payload.pull_request.head.sha }}
90108

91109
- name: Set up Python
92-
uses: actions/setup-python@v4
110+
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
93111
with:
94112
python-version: '3.x'
95113

@@ -112,7 +130,7 @@ jobs:
112130
python example/example.py
113131
114132
# Update check run called "integration-fork" on the forked PR
115-
- uses: actions/github-script@v6
133+
- uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
116134
id: update-check-run
117135
if: ${{ always() }}
118136
env:

0 commit comments

Comments
 (0)