Skip to content

Commit 9bb484a

Browse files
[StepSecurity] ci: Harden GitHub Actions
Signed-off-by: StepSecurity Bot <[email protected]>
1 parent fa8e647 commit 9bb484a

8 files changed

Lines changed: 52 additions & 17 deletions

File tree

.github/workflows/git-sizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
steps:
1515
- name: Run git-sizer
1616
id: sizer
17-
uses: ChrisCarini/github-git-sizer-action@latest
17+
uses: ChrisCarini/github-git-sizer-action@09eaa4ae73038a5f0bbdc7e7b964f1bf6114c277 # latest
1818
with:
1919
flags: '--threshold=0'
2020

.github/workflows/gitleaks.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ jobs:
1616
name: gitleaks
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v4
19+
- name: Harden the runner (Audit all outbound calls)
20+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
21+
with:
22+
egress-policy: audit
23+
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2025
with:
2126
fetch-depth: 0
22-
- uses: gitleaks/gitleaks-action@v2
27+
- uses: gitleaks/gitleaks-action@ff98106e4c7b2bc287b24eaf42907196329070c7 # v2.3.9
2328
env:
2429
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2530
# GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }} # Uncomment if using in an organization

.github/workflows/mega-linter.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21+
- name: Harden the runner (Audit all outbound calls)
22+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
23+
with:
24+
egress-policy: audit
25+
2126
- name: Checkout repository
22-
uses: actions/checkout@v4
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2328

2429
- name: MegaLinter
2530
id: megalinter
26-
uses: oxsecurity/[email protected]
31+
uses: oxsecurity/megalinter@5a91fb06c83d0e69fbd23756d47438aa723b4a5a # v8.7.0
2732
env:
2833
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2934
DISABLE_LINTERS: SPELL_CSPELL
@@ -45,7 +50,7 @@ jobs:
4550
# Upload MegaLinter artifacts
4651
- name: Archive production artifacts
4752
if: success() || failure()
48-
uses: actions/upload-artifact@v4
53+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
4954
with:
5055
name: MegaLinter reports
5156
path: |

.github/workflows/pssecret-scanner.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ jobs:
1818
pssecret-scanner:
1919
runs-on: ubuntu-latest
2020
steps:
21+
- name: Harden the runner (Audit all outbound calls)
22+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
23+
with:
24+
egress-policy: audit
25+
2126
- name: Checkout code
22-
uses: actions/checkout@v4
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2328
# PowerShell is available by default on ubuntu-latest, so no setup step is required
2429
- name: Install PSSecretScanner
2530
shell: pwsh

.github/workflows/rebase.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ jobs:
1616
group: rebase-${{ github.ref }}
1717
cancel-in-progress: false
1818
steps:
19+
- name: Harden the runner (Audit all outbound calls)
20+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
21+
with:
22+
egress-policy: audit
23+
1924
- name: Checkout the latest code
20-
uses: actions/checkout@v3
25+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
2126
with:
2227
token: ${{ secrets.GITHUB_TOKEN }}
2328
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
2429
- name: Automatic Rebase
25-
uses: cirrus-actions/[email protected]
30+
uses: cirrus-actions/rebase@b87d48154a87a85666003575337e27b8cd65f691 # 1.8
2631
with:
2732
autosquash: ${{ contains(github.event.comment.body, '/autosquash') || contains(github.event.comment.body, '/rebase-autosquash') }}
2833
env:

.github/workflows/security-devops.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,16 @@ jobs:
1818
msdo:
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: actions/[email protected]
21+
- name: Harden the runner (Audit all outbound calls)
22+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
23+
with:
24+
egress-policy: audit
25+
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2227
- name: Run Microsoft Security DevOps
23-
uses: microsoft/security-devops-action@latest
28+
uses: microsoft/security-devops-action@d0736c546281e0632667b8e0046ae3d7bba0bf67 # latest
2429
id: msdo
2530
- name: Upload results to Security tab
26-
uses: github/codeql-action/upload-sarif@v3
31+
uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
2732
with:
2833
sarif_file: ${{ steps.msdo.outputs.sarifFile }}

.github/workflows/spelling_action.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,19 @@ jobs:
1313
name: Spellcheck
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v4
17-
- uses: rojopolis/[email protected]
16+
- name: Harden the runner (Audit all outbound calls)
17+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
18+
with:
19+
egress-policy: audit
20+
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
- uses: rojopolis/spellcheck-github-actions@23dc186319866e1de224f94fe1d31b72797aeec7 # 0.48.0
1823
name: Spellcheck
1924
continue-on-error: true
2025
with:
2126
config_path: .github/.spellcheck.yml
2227
output_file: spellcheck-output.txt
23-
- uses: actions/upload-artifact@v4
28+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2429
if: ${{ !cancelled() }}
2530
with:
2631
name: Spellcheck Output

.github/workflows/typos.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ jobs:
1616
typos:
1717
runs-on: ubuntu-latest
1818
steps:
19+
- name: Harden the runner (Audit all outbound calls)
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
- name: Run typos (spell checker)
22-
uses: crate-ci/[email protected]
27+
uses: crate-ci/typos@0f0ccba9ed1df83948f0c15026e4f5ccfce46109 # v1.32.0
2328
with:
2429
files: |
2530
tests

0 commit comments

Comments
 (0)