Skip to content

Commit bf161cd

Browse files
chore: apply StepSecurity Workflow Security Recommendations (#28)
* chore: apply security best practices * chore: harded the builds * chore: harded the builds --------- Co-authored-by: StepSecurity Bot <bot@stepsecurity.io>
1 parent 3f91089 commit bf161cd

File tree

14 files changed

+155
-29
lines changed

14 files changed

+155
-29
lines changed

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,20 @@ updates:
3333
patterns:
3434
- "*"
3535
applies-to: "security-updates"
36+
37+
- package-ecosystem: "docker"
38+
directory: "/"
39+
schedule:
40+
interval: "weekly"
41+
commit-message:
42+
prefix: "chore(deps):"
43+
open-pull-requests-limit: 10
44+
groups:
45+
actions-version-updates:
46+
patterns:
47+
- "*"
48+
applies-to: "version-updates"
49+
actions-security-updates:
50+
patterns:
51+
- "*"
52+
applies-to: "security-updates"

.github/workflows/commitlint.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,30 @@ on:
77
required: true
88
type: string
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
lint-commits:
15+
permissions:
16+
contents: read
17+
pull-requests: read
1218
runs-on: ubuntu-latest
1319
name: Validate Commits
1420

1521
steps:
22+
- name: Harden runner
23+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
24+
with:
25+
egress-policy: audit
26+
1627
- name: Checkout code
17-
uses: actions/checkout@v4
28+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1829
with:
1930
ref: ${{ inputs.ref }}
2031
fetch-depth: 0
2132

2233
- name: Inspect Commits
23-
uses: wagoid/commitlint-github-action@v6
34+
uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6.2.1
2435
with:
2536
configFile: .commitlintrc.json

.github/workflows/depcheck.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Dependency Review
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
dependency-review:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Harden Runner
14+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
15+
with:
16+
egress-policy: audit
17+
18+
- name: Checkout code
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
21+
- name: Review Dependencies
22+
uses: actions/dependency-review-action@da24556b548a50705dd671f47852072ea4c105d9 # v4.7.1

.github/workflows/docker.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,30 @@ on:
1010
type: string
1111
default: 'temp'
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
Build-Container:
1518
runs-on: ubuntu-latest
1619
name: Build Container
1720

1821
steps:
22+
- name: Harden runner
23+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
24+
with:
25+
egress-policy: audit
26+
1927
- name: Checkout code
20-
uses: actions/checkout@v4
28+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2129
with:
2230
ref: ${{ inputs.ref }}
2331

2432
- name: Set up Docker Buildx
25-
uses: docker/setup-buildx-action@v3
33+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
2634

2735
- name: Build Docker image
28-
uses: docker/build-push-action@v6
36+
uses: docker/build-push-action@1dc73863535b631f98b2378be8619f83b136f4a0 # v6.17.0
2937
with:
3038
context: .
3139
file: ./Dockerfile

.github/workflows/integration.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
required: true
1111
type: string
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
check-compatibility:
1518
name: With Python ${{ matrix.python-version }}
@@ -20,14 +23,19 @@ jobs:
2023
fail-fast: false
2124

2225
steps:
26+
- name: Harden runner
27+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
28+
with:
29+
egress-policy: audit
30+
2331
- name: Checkout code
24-
uses: actions/checkout@v4
32+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2533
with:
2634
ref: ${{ inputs.library_ref }}
2735
path: project/library
2836

2937
- name: Checkout sanity stub
30-
uses: actions/checkout@v4
38+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3139
with:
3240
ref: ${{ inputs.sanity_ref }}
3341
path: project/sanity
@@ -38,7 +46,7 @@ jobs:
3846
pipx install poetry
3947
4048
- name: Setup Python
41-
uses: actions/setup-python@v5
49+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
4250
with:
4351
python-version: ${{ matrix.python-version }}
4452
cache: 'poetry'

.github/workflows/linting.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,24 @@ defaults:
1515
run:
1616
working-directory: ./
1717

18+
permissions:
19+
contents: read
20+
1821
jobs:
1922
lint-format:
23+
permissions:
24+
contents: write
2025
runs-on: ubuntu-latest
2126
name: Reformat Code
2227

2328
steps:
29+
- name: Harden runner
30+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
31+
with:
32+
egress-policy: audit
33+
2434
- name: Checkout code
25-
uses: actions/checkout@v4
35+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2636
with:
2737
ref: ${{ inputs.ref }}
2838

@@ -31,7 +41,7 @@ jobs:
3141
pipx install poetry
3242
3343
- name: Setup Python
34-
uses: actions/setup-python@v5
44+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
3545
with:
3646
python-version-file: 'pyproject.toml'
3747
cache: 'poetry'
@@ -44,7 +54,7 @@ jobs:
4454

4555
- name: Commit Changes
4656
if: ${{ inputs.commit_changes == true }}
47-
uses: stefanzweifel/git-auto-commit-action@v5
57+
uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5.2.0
4858
with:
4959
commit_message: 'style: Apply automated code formatting [skip ci]'
5060
commit_options: '--no-verify'

.github/workflows/pipeline.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ jobs:
8181
- code-inspection
8282
- build-docker
8383
steps:
84+
- name: Harden runner
85+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
86+
with:
87+
egress-policy: audit
88+
8489
- name: Report Success
8590
run: echo "All required checks passed successfully."
8691

.github/workflows/qodana.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,30 @@ jobs:
2828
name: Inspect Code
2929

3030
steps:
31+
- name: Harden runner
32+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
33+
with:
34+
egress-policy: audit
35+
3136
- name: Checkout code
32-
uses: actions/checkout@v4
37+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3338
with:
3439
ref: ${{ inputs.ref }}
3540

3641
- name: Download Test Reports Artifact
37-
uses: actions/download-artifact@v4
42+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
3843
with:
3944
name: ${{ inputs.test_artifact_name }}
4045
path: ./qodana-downloaded-reports/test-results
4146

4247
- name: Download Coverage Report Artifact
43-
uses: actions/download-artifact@v4
48+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
4449
with:
4550
name: ${{ inputs.coverage_artifact_name }}
4651
path: ./.qodana/code-coverage
4752

4853
- name: Run Qodana
49-
uses: JetBrains/qodana-action@v2025.1
54+
uses: JetBrains/qodana-action@201551778d1453e36c5c0aa26f89a94775cb1acc # v2025.1
5055
with:
5156
args: --baseline,.qodana/qodana.sarif.json
5257
push-fixes: true

.github/workflows/release.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ jobs:
1616
name: To Artifactory
1717

1818
steps:
19+
- name: Harden runner
20+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
21+
with:
22+
egress-policy: audit
23+
1924
- name: Checkout code
20-
uses: actions/checkout@v4
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2126
with:
2227
fetch-depth: 0
2328

@@ -26,13 +31,13 @@ jobs:
2631
pipx install poetry
2732
2833
- name: Setup Python
29-
uses: actions/setup-python@v5
34+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
3035
with:
3136
python-version-file: 'pyproject.toml'
3237
cache: 'poetry'
3338

3439
- name: Setup Node.js
35-
uses: actions/setup-node@v4
40+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
3641
with:
3742
node-version: 'lts/*'
3843

.github/workflows/scorecard.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches:
66
- main
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
scorecard_analysis:
1013
name: Scorecard Analysis
@@ -15,19 +18,24 @@ jobs:
1518
id-token: write
1619

1720
steps:
21+
- name: Harden runner
22+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
23+
with:
24+
egress-policy: audit
25+
1826
- name: Checkout Repository
19-
uses: actions/checkout@v4
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2028
with:
2129
persist-credentials: false
2230

2331
- name: Run Checks
24-
uses: ossf/scorecard-action@v2.4.1
32+
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
2533
with:
2634
results_file: results.sarif
2735
results_format: sarif
2836
publish_results: true
2937

3038
- name: Upload Results
31-
uses: github/codeql-action/upload-sarif@v3
39+
uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
3240
with:
3341
sarif_file: results.sarif

0 commit comments

Comments
 (0)