Skip to content

Commit 73cc784

Browse files
chore: [StepSecurity] ci: Harden GitHub Actions (open-feature#120)
* [StepSecurity] ci: Harden GitHub Actions in release.yml * [StepSecurity] ci: Harden GitHub Actions in static-code-scanning.yaml * [StepSecurity] ci: Harden GitHub Actions in lint-pr.yml * [StepSecurity] ci: Harden GitHub Actions in merge.yml * [StepSecurity] ci: Harden GitHub Actions in pullrequest.yml
1 parent 9647c3f commit 73cc784

File tree

5 files changed

+33
-18
lines changed

5 files changed

+33
-18
lines changed

Diff for: .github/workflows/lint-pr.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@ on:
77
- edited
88
- synchronize
99

10+
permissions: # added using https://github.com/step-security/secure-workflows
11+
contents: read
12+
1013
jobs:
1114
main:
15+
permissions:
16+
pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs
17+
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
1218
name: Validate PR title
1319
runs-on: ubuntu-latest
1420
steps:
15-
- uses: amannn/action-semantic-pull-request@v4
21+
- uses: amannn/action-semantic-pull-request@505e44b4f33b4c801f063838b3f053990ee46ea7
1622
env:
1723
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: .github/workflows/merge.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222
packages: write
2323

2424
steps:
25-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
2626
- name: Set up JDK 8
27-
uses: actions/setup-java@v3
27+
uses: actions/setup-java@a18c333f3f14249953dab3e186e5e21bf3390f1d
2828
with:
2929
java-version: '8'
3030
distribution: 'temurin'
@@ -34,7 +34,7 @@ jobs:
3434
server-password: ${{ secrets.OSSRH_PASSWORD }}
3535

3636
- name: Cache local Maven repository
37-
uses: actions/cache@v3
37+
uses: actions/cache@56461b9eb0f8438fd15c7a9968e3c9ebb18ceff1
3838
with:
3939
path: ~/.m2/repository
4040
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -51,7 +51,7 @@ jobs:
5151
run: mvn --batch-mode --update-snapshots verify
5252

5353
- name: Upload coverage to Codecov
54-
uses: codecov/codecov-action@v3
54+
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
5555
with:
5656
flags: unittests # optional
5757
name: coverage # optional

Diff for: .github/workflows/pullrequest.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ jobs:
1818
packages: write
1919
steps:
2020
- name: Check out the code
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
2222

2323
- name: Set up JDK 8
24-
uses: actions/setup-java@v3
24+
uses: actions/setup-java@a18c333f3f14249953dab3e186e5e21bf3390f1d
2525
with:
2626
java-version: '8'
2727
distribution: 'temurin'
2828
cache: maven
2929

3030
- name: Initialize CodeQL
31-
uses: github/codeql-action/init@v2
31+
uses: github/codeql-action/init@e0e5ded33cabb451ae0a9768fc7b0410bad9ad44
3232
with:
3333
languages: java
3434

3535
- name: Cache local Maven repository
36-
uses: actions/cache@v3
36+
uses: actions/cache@56461b9eb0f8438fd15c7a9968e3c9ebb18ceff1
3737
with:
3838
path: ~/.m2/repository
3939
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -44,12 +44,12 @@ jobs:
4444
run: mvn --batch-mode --update-snapshots verify # -P integration-test - add this back once we have a compatible flagd
4545

4646
- name: Upload coverage to Codecov
47-
uses: codecov/codecov-action@v3
47+
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
4848
with:
4949
flags: unittests # optional
5050
name: coverage # optional
5151
fail_ci_if_error: true # optional (default = false)
5252
verbose: true # optional (default = false)
5353

5454
- name: Perform CodeQL Analysis
55-
uses: github/codeql-action/analyze@v2
55+
uses: github/codeql-action/analyze@e0e5ded33cabb451ae0a9768fc7b0410bad9ad44

Diff for: .github/workflows/release.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@ on:
77
branches:
88
- main
99
name: Run Release Please
10+
permissions: # added using https://github.com/step-security/secure-workflows
11+
contents: read
12+
1013
jobs:
1114
release-please:
15+
permissions:
16+
contents: write # for google-github-actions/release-please-action to create release commit
17+
pull-requests: write # for google-github-actions/release-please-action to create release PR
1218
runs-on: ubuntu-latest
1319

1420
# Release-please creates a PR that tracks all changes
1521
steps:
16-
- uses: google-github-actions/release-please-action@v3
22+
- uses: google-github-actions/release-please-action@069d7229d7b10308de85bc606a91e0033e259c8e
1723
id: release
1824
with:
1925
command: manifest
@@ -23,10 +29,10 @@ jobs:
2329
# These steps are only run if this was a merged release-please PR
2430
- name: checkout
2531
if: ${{ steps.release.outputs.releases_created }}
26-
uses: actions/checkout@v3
32+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
2733
- name: Set up JDK 8
2834
if: ${{ steps.release.outputs.releases_created }}
29-
uses: actions/setup-java@v3
35+
uses: actions/setup-java@a18c333f3f14249953dab3e186e5e21bf3390f1d
3036
with:
3137
java-version: '8'
3238
distribution: 'temurin'

Diff for: .github/workflows/static-code-scanning.yaml

+7-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ on:
1515
# * * * * *
1616
- cron: '30 1 * * 1'
1717

18+
permissions: # added using https://github.com/step-security/secure-workflows
19+
contents: read
20+
1821
jobs:
1922
CodeQL-Build:
2023
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
@@ -26,16 +29,16 @@ jobs:
2629

2730
steps:
2831
- name: Checkout repository
29-
uses: actions/checkout@v3
32+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
3033

3134
# Initializes the CodeQL tools for scanning.
3235
- name: Initialize CodeQL
33-
uses: github/codeql-action/init@v2
36+
uses: github/codeql-action/init@e0e5ded33cabb451ae0a9768fc7b0410bad9ad44
3437
with:
3538
languages: java
3639

3740
- name: Autobuild
38-
uses: github/codeql-action/autobuild@v2
41+
uses: github/codeql-action/autobuild@e0e5ded33cabb451ae0a9768fc7b0410bad9ad44
3942

4043
- name: Perform CodeQL Analysis
41-
uses: github/codeql-action/analyze@v2
44+
uses: github/codeql-action/analyze@e0e5ded33cabb451ae0a9768fc7b0410bad9ad44

0 commit comments

Comments
 (0)