Skip to content

Commit f1b61d1

Browse files
ci: [StepSecurity] Apply security best practices (#455)
* [StepSecurity] Apply security best practices Signed-off-by: StepSecurity Bot <bot@stepsecurity.io> * fix: Update checkout action to include persist-credentials Added persist-credentials option to checkout action. Signed-off-by: Jason Meridth <jmeridth@gmail.com> * fix: Update checkout action to not persist credentials Set persist-credentials to false for checkout action. Signed-off-by: Jason Meridth <jmeridth@gmail.com> * fix: quotes in dependency-review.yml Signed-off-by: Jason Meridth <jmeridth@gmail.com> * fix: Reformat .pre-commit-config.yaml for consistency Signed-off-by: Jason Meridth <jmeridth@gmail.com> * chore: Update actions/checkout to version 6.0.2 Signed-off-by: Jason Meridth <jmeridth@gmail.com> * chore: Update checkout action to version 6.0.2 Signed-off-by: Jason Meridth <jmeridth@gmail.com> * fix: formatting in .pre-commit-config.yaml Signed-off-by: Jason Meridth <jmeridth@gmail.com> * fix: Update pre-commit configuration for Python linters ran this locally: ``` brew install pre-commit pre-commit install pre-commit clean pre-commit run --all-files ``` Result: ``` Cleaned /Users/jmeridth/.cache/pre-commit. [INFO] Initializing environment for https://github.com/gitleaks/gitleaks. [INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks. [INFO] Installing environment for https://github.com/gitleaks/gitleaks. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... [INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... Detect hardcoded secrets.................................................Passed fix end of files.........................................................Passed trim trailing whitespace.................................................Passed flake8...................................................................Passed isort....................................................................Passed pylint...................................................................Passed mypy.....................................................................Passed black....................................................................Passed ``` Signed-off-by: Jason Meridth <jmeridth@gmail.com> --------- Signed-off-by: StepSecurity Bot <bot@stepsecurity.io> Signed-off-by: Jason Meridth <jmeridth@gmail.com> Co-authored-by: Jason Meridth <jmeridth@gmail.com> Co-authored-by: Jason Meridth <jmeridth@proton.me>
1 parent d0f1b1d commit f1b61d1

11 files changed

Lines changed: 187 additions & 1 deletion

.github/workflows/codeql.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: ["main"]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: ["main"]
20+
schedule:
21+
- cron: "0 0 * * 1"
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
analyze:
28+
name: Analyze
29+
runs-on: ubuntu-latest
30+
permissions:
31+
actions: read
32+
contents: read
33+
security-events: write
34+
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
language: ["python"]
39+
# CodeQL supports [ $supported-codeql-languages ]
40+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
41+
42+
steps:
43+
- name: Harden the runner (Audit all outbound calls)
44+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
45+
with:
46+
egress-policy: audit
47+
48+
- name: Checkout repository
49+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
50+
with:
51+
persist-credentials: false
52+
53+
# Initializes the CodeQL tools for scanning.
54+
- name: Initialize CodeQL
55+
uses: github/codeql-action/init@820e3160e279568db735cee8ed8f8e77a6da7818 # v3.32.6
56+
with:
57+
languages: ${{ matrix.language }}
58+
# If you wish to specify custom queries, you can do so here or in a config file.
59+
# By default, queries listed here will override any specified in a config file.
60+
# Prefix the list here with "+" to use these queries and those in the config file.
61+
62+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
63+
# If this step fails, then you should remove it and run the build manually (see below)
64+
- name: Autobuild
65+
uses: github/codeql-action/autobuild@820e3160e279568db735cee8ed8f8e77a6da7818 # v3.32.6
66+
67+
# ℹ️ Command-line programs to run using the OS shell.
68+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
69+
70+
# If the Autobuild fails above, remove it and uncomment the following three lines.
71+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
72+
73+
# - run: |
74+
# echo "Run, Build Application using script"
75+
# ./location_of_script_within_repo/buildscript.sh
76+
77+
- name: Perform CodeQL Analysis
78+
uses: github/codeql-action/analyze@820e3160e279568db735cee8ed8f8e77a6da7818 # v3.32.6
79+
with:
80+
category: "/language:${{matrix.language}}"

.github/workflows/copilot-setup-steps.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ jobs:
2525
# You can define any steps you want, and they will run before the agent starts.
2626
# If you do not check out your code, Copilot will do this for you.
2727
steps:
28+
- name: Harden the runner (Audit all outbound calls)
29+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
30+
with:
31+
egress-policy: audit
32+
2833
- name: Checkout code
2934
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3035
with:
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
21+
with:
22+
egress-policy: audit
23+
24+
- name: "Checkout Repository"
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
with:
27+
persist-credentials: false
28+
- name: "Dependency Review"
29+
uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48 # v4.9.0

.github/workflows/docker-image.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ jobs:
1414
build:
1515
runs-on: ubuntu-latest
1616
steps:
17+
- name: Harden the runner (Audit all outbound calls)
18+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
19+
with:
20+
egress-policy: audit
21+
1722
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1823
with:
1924
persist-credentials: false

.github/workflows/linter.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ jobs:
2121
packages: read
2222
statuses: write
2323
steps:
24+
- name: Harden the runner (Audit all outbound calls)
25+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
26+
with:
27+
egress-policy: audit
28+
2429
- name: Checkout Code
2530
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2631
with:

.github/workflows/major-version-updater.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ jobs:
1616
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.ref }} changes
1717
runs-on: ubuntu-latest
1818
steps:
19+
- name: Harden the runner (Audit all outbound calls)
20+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
21+
with:
22+
egress-policy: audit
23+
1924
- name: Checkout Repo
2025
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2126
with:

.github/workflows/python-package.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ jobs:
2323
matrix:
2424
python-version: [3.11, 3.12, 3.13, 3.14]
2525
steps:
26+
- name: Harden the runner (Audit all outbound calls)
27+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
28+
with:
29+
egress-policy: audit
30+
2631
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2732
with:
2833
persist-credentials: false

.github/workflows/scorecard.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ jobs:
2424
id-token: write
2525

2626
steps:
27+
- name: Harden the runner (Audit all outbound calls)
28+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
29+
with:
30+
egress-policy: audit
31+
2732
- name: "Checkout code"
2833
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2934
with:

.github/workflows/stale.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ jobs:
1111
stale:
1212
runs-on: ubuntu-latest
1313
steps:
14+
- name: Harden the runner (Audit all outbound calls)
15+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
16+
with:
17+
egress-policy: audit
18+
1419
- uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f # v10.2.0
1520
with:
1621
stale-issue-message: "This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 14 days."

.github/workflows/use-action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@ jobs:
1818
issues: write
1919
packages: read
2020
steps:
21+
- name: Harden the runner (Audit all outbound calls)
22+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
23+
with:
24+
egress-policy: audit
25+
2126
- name: Checkout code
2227
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2328
with:
2429
persist-credentials: false
2530
- name: Run stale_repos tool
26-
uses: docker://ghcr.io/github-community-projects/stale_repos:v9
31+
uses: docker://ghcr.io/github-community-projects/stale_repos:v9@sha256:374277cb9863651aeebd9a45f09083aaec013e72982d217bf4b058baa60bbc4a
2732
env:
2833
GH_TOKEN: ${{ secrets.GH_TOKEN }}
2934
ORGANIZATION: github

0 commit comments

Comments
 (0)