Skip to content

Commit e90d89a

Browse files
[StepSecurity] Apply security best practices
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
1 parent e1bfae1 commit e90d89a

11 files changed

Lines changed: 116 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: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,15 @@ on:
2121
schedule:
2222
- cron: '24 22 * * 4'
2323

24+
permissions:
25+
contents: read
26+
2427
jobs:
2528
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
2633
name: Analyze
2734
runs-on: ubuntu-latest
2835

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

3744
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+
3850
- name: Checkout repository
39-
uses: actions/checkout@v5
51+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4052

4153
# Initializes the CodeQL tools for scanning.
4254
- name: Initialize CodeQL
43-
uses: github/codeql-action/init@v3
55+
uses: github/codeql-action/init@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5
4456
with:
4557
languages: ${{ matrix.language }}
4658
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -51,7 +63,7 @@ jobs:
5163
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5264
# If this step fails, then you should remove it and run the build manually (see below)
5365
- name: Autobuild
54-
uses: github/codeql-action/autobuild@v3
66+
uses: github/codeql-action/autobuild@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.30.5
5567

5668
# ℹ️ Command-line programs to run using the OS shell.
5769
# 📚 https://git.io/JvXDl
@@ -65,4 +77,4 @@ jobs:
6577
# make release
6678

6779
- name: Perform CodeQL Analysis
68-
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
@@ -12,22 +12,27 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15+
- name: Harden the runner (Audit all outbound calls)
16+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
17+
with:
18+
egress-policy: audit
19+
1520
- name: Checkout repository
16-
uses: actions/checkout@v5
21+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1722

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

2934
- name: Build DevContainer image
30-
uses: devcontainers/ci@v0.3
35+
uses: devcontainers/ci@8bf61b26e9c3a98f69cb6ce2f88d24ff59b785c6 # v0.3.1900000417
3136
with:
3237
runCmd: |
3338
echo "Installing test dependencies..."

.github/workflows/docs.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,22 @@ name: "Docs"
22
on:
33
- pull_request
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69
docs:
710
runs-on: ubuntu-latest
811
steps:
9-
- 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
1018

1119
- name: Install Python
12-
uses: actions/setup-python@v6
20+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
1321
with:
1422
python-version: '3.x'
1523

.github/workflows/landing-page.yml

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

1520
- name: Setup Python
16-
uses: actions/setup-python@v6
21+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
1722
with:
1823
python-version: "3.12"
1924

@@ -27,7 +32,7 @@ jobs:
2732
cd doc/landing-page
2833
make html
2934
- name: Publish
30-
uses: tsunematsu21/actions-publish-gh-pages@v1.0.2
35+
uses: tsunematsu21/actions-publish-gh-pages@c04b531c52b8f9d25c596bc6e6a7ddc116b2f3f8 # v1.0.2
3136
with:
3237
dir: doc/landing-page/_build/html
3338
repo: dfetch-org/dfetch-org.github.io

.github/workflows/python-publish.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
# Allows to run this workflow manually
1111
workflow_dispatch:
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
deploy:
1518

@@ -19,9 +22,14 @@ jobs:
1922
id-token: write
2023

2124
steps:
22-
- 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
2331
- name: Set up Python
24-
uses: actions/setup-python@v6
32+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
2533
with:
2634
python-version: '3.x'
2735
- name: Install dependencies

.github/workflows/run.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ jobs:
1313
runs-on: windows-latest
1414

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

18-
- uses: cygwin/cygwin-install-action@master
23+
- uses: cygwin/cygwin-install-action@b9bf9147075ee9811ac11beee9351eeb93e2f2fb # master
1924

2025
- name: Install Subversion (SVN) on Windows
2126
run: |
@@ -54,10 +59,15 @@ jobs:
5459
runs-on: ${{ matrix.platform }}
5560

5661
steps:
57-
- uses: actions/checkout@v5
62+
- name: Harden the runner (Audit all outbound calls)
63+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
64+
with:
65+
egress-policy: audit
66+
67+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5868

5969
- name: Setup Python
60-
uses: actions/setup-python@v6
70+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
6171
with:
6272
python-version: ${{ matrix.python-version }}
6373

.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: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,22 @@ on:
77
pull_request:
88
types: [opened, synchronize, reopened]
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
test:
1215
runs-on: ubuntu-latest
1316
steps:
14-
- 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
1523

1624
- name: Setup Python
17-
uses: actions/setup-python@v6
25+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
1826
with:
1927
python-version: '3.12'
2028

@@ -47,7 +55,7 @@ jobs:
4755
- run: pyroma --directory --min=10 . # Check pyproject
4856

4957
- name: Run codacy-coverage-reporter
50-
uses: codacy/codacy-coverage-reporter-action@master
58+
uses: codacy/codacy-coverage-reporter-action@a38818475bb21847788496e9f0fddaa4e84955ba # master
5159
with:
5260
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
5361
coverage-reports: coverage.xml

0 commit comments

Comments
 (0)