Skip to content

Commit dfb23f5

Browse files
step-security-botspoorcc
authored andcommitted
[StepSecurity] Apply security best practices
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
1 parent cbf79b3 commit dfb23f5

11 files changed

Lines changed: 104 additions & 24 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/devcontainers/python:1-3.12-bullseye
1+
FROM mcr.microsoft.com/devcontainers/python:1-3.12-bullseye@sha256:cf244ba2b96e9515d1f9efb6641419e9cfec8a9de5fa15bf1e6c76a7928f5383
22

33
# Install dependencies
44
# pv is required for asciicasts

.github/workflows/codeql-analysis.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ permissions:
2626

2727
jobs:
2828
analyze:
29+
permissions:
30+
actions: read # for github/codeql-action/init to get workflow details
31+
contents: read # for actions/checkout to fetch code
32+
security-events: write # for github/codeql-action/autobuild to send a status report
2933
name: Analyze
3034
runs-on: ubuntu-latest
3135

@@ -38,12 +42,17 @@ jobs:
3842
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
3943

4044
steps:
45+
- name: Harden the runner (Audit all outbound calls)
46+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
47+
with:
48+
egress-policy: audit
49+
4150
- name: Checkout repository
42-
uses: actions/checkout@v5
51+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4352

4453
# Initializes the CodeQL tools for scanning.
4554
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v3
55+
uses: github/codeql-action/init@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5
4756
with:
4857
languages: ${{ matrix.language }}
4958
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -54,7 +63,7 @@ jobs:
5463
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5564
# If this step fails, then you should remove it and run the build manually (see below)
5665
- name: Autobuild
57-
uses: github/codeql-action/autobuild@v3
66+
uses: github/codeql-action/autobuild@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5
5867

5968
# ℹ️ Command-line programs to run using the OS shell.
6069
# 📚 https://git.io/JvXDl
@@ -68,4 +77,4 @@ jobs:
6877
# make release
6978

7079
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v3
80+
uses: github/codeql-action/analyze@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Dependency Review Action
2+
#
3+
# This Action will scan dependency manifest files that change as part of a Pull Request,
4+
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
5+
# Once installed, if the workflow run is marked as required,
6+
# PRs introducing known-vulnerable packages will be blocked from merging.
7+
#
8+
# Source repository: https://github.com/actions/dependency-review-action
9+
name: 'Dependency Review'
10+
on: [pull_request]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
dependency-review:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Harden the runner (Audit all outbound calls)
20+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
21+
with:
22+
egress-policy: audit
23+
24+
- name: 'Checkout Repository'
25+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
26+
- name: 'Dependency Review'
27+
uses: actions/dependency-review-action@56339e523c0409420f6c2c9a2f4292bbb3c07dd3 # v4.8.0

.github/workflows/devcontainer.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,27 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18+
- name: Harden the runner (Audit all outbound calls)
19+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
20+
with:
21+
egress-policy: audit
22+
1823
- name: Checkout repository
19-
uses: actions/checkout@v5
24+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2025

2126
- name: Cache Docker layers
22-
uses: actions/cache@v4
27+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
2328
with:
2429
path: /tmp/.buildx-cache
2530
key: devcontainer-${{ runner.os }}-${{ github.sha }}
2631
restore-keys: |
2732
devcontainer-${{ runner.os }}-
2833
2934
- name: Set up Docker Buildx
30-
uses: docker/setup-buildx-action@v3
35+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
3136

3237
- name: Build DevContainer image
33-
uses: devcontainers/ci@v0.3
38+
uses: devcontainers/ci@8bf61b26e9c3a98f69cb6ce2f88d24ff59b785c6 # v0.3.1900000417
3439
with:
3540
runCmd: |
3641
echo "Installing test dependencies..."

.github/workflows/docs.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ jobs:
99
docs:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v5
12+
- name: Harden the runner (Audit all outbound calls)
13+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
14+
with:
15+
egress-policy: audit
16+
17+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1318

1419
- name: Install Python
15-
uses: actions/setup-python@v6
20+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
1621
with:
1722
python-version: '3.x'
1823

.github/workflows/landing-page.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@ jobs:
1313
publish:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v5
16+
- name: Harden the runner (Audit all outbound calls)
17+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
18+
with:
19+
egress-policy: audit
20+
21+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1722

1823
- name: Setup Python
19-
uses: actions/setup-python@v6
24+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
2025
with:
2126
python-version: "3.12"
2227

@@ -30,7 +35,7 @@ jobs:
3035
cd doc/landing-page
3136
make html
3237
- name: Publish
33-
uses: tsunematsu21/actions-publish-gh-pages@v1.0.2
38+
uses: tsunematsu21/actions-publish-gh-pages@c04b531c52b8f9d25c596bc6e6a7ddc116b2f3f8 # v1.0.2
3439
with:
3540
dir: doc/landing-page/_build/html
3641
repo: dfetch-org/dfetch-org.github.io

.github/workflows/python-publish.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,14 @@ jobs:
2222
id-token: write
2323

2424
steps:
25-
- uses: actions/checkout@v5
25+
- name: Harden the runner (Audit all outbound calls)
26+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
27+
with:
28+
egress-policy: audit
29+
30+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2631
- name: Set up Python
27-
uses: actions/setup-python@v6
32+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
2833
with:
2934
python-version: '3.x'
3035
- name: Install dependencies

.github/workflows/run.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ jobs:
1616
runs-on: windows-latest
1717

1818
steps:
19-
- uses: actions/checkout@v5
19+
- name: Harden the runner (Audit all outbound calls)
20+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
21+
with:
22+
egress-policy: audit
23+
24+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2025

21-
- uses: cygwin/cygwin-install-action@master
26+
- uses: cygwin/cygwin-install-action@b9bf9147075ee9811ac11beee9351eeb93e2f2fb # master
2227

2328
- name: Install Subversion (SVN) on Windows
2429
run: |
@@ -57,10 +62,15 @@ jobs:
5762
runs-on: ${{ matrix.platform }}
5863

5964
steps:
60-
- uses: actions/checkout@v5
65+
- name: Harden the runner (Audit all outbound calls)
66+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
67+
with:
68+
egress-policy: audit
69+
70+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
6171

6272
- name: Setup Python
63-
uses: actions/setup-python@v6
73+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
6474
with:
6575
python-version: ${{ matrix.python-version }}
6676

.github/workflows/scorecard.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ jobs:
3333
# actions: read
3434

3535
steps:
36+
- name: Harden the runner (Audit all outbound calls)
37+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
38+
with:
39+
egress-policy: audit
40+
3641
- name: "Checkout code"
3742
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3843
with:
@@ -73,6 +78,6 @@ jobs:
7378
# Upload the results to GitHub's code scanning dashboard (optional).
7479
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
7580
- name: "Upload to code-scanning"
76-
uses: github/codeql-action/upload-sarif@v3
81+
uses: github/codeql-action/upload-sarif@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5
7782
with:
7883
sarif_file: results.sarif

.github/workflows/test.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ jobs:
1414
test:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v5
17+
- name: Harden the runner (Audit all outbound calls)
18+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
19+
with:
20+
egress-policy: audit
21+
22+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1823

1924
- name: Setup Python
20-
uses: actions/setup-python@v6
25+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
2126
with:
2227
python-version: '3.12'
2328

@@ -50,7 +55,7 @@ jobs:
5055
- run: pyroma --directory --min=10 . # Check pyproject
5156

5257
- name: Run codacy-coverage-reporter
53-
uses: codacy/codacy-coverage-reporter-action@master
58+
uses: codacy/codacy-coverage-reporter-action@a38818475bb21847788496e9f0fddaa4e84955ba # master
5459
with:
5560
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
5661
coverage-reports: coverage.xml

0 commit comments

Comments
 (0)