Skip to content

Commit 9e9bcc6

Browse files
authored
Add step-security/harden-runner (#1533)
1 parent 3decf31 commit 9e9bcc6

File tree

11 files changed

+89
-29
lines changed

11 files changed

+89
-29
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ jobs:
2020
MINVERBUILDMETADATA: build.${{github.run_number}}
2121

2222
steps:
23+
- name: Harden Runner
24+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
25+
with:
26+
egress-policy: audit
27+
2328
- name: Checkout repository
2429
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2530
with:

.github/workflows/codeql-analysis.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: "CodeQL"
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88
schedule:
9-
- cron: '27 10 * * 1'
9+
- cron: "27 10 * * 1"
1010

1111
permissions:
1212
contents: read
@@ -21,18 +21,23 @@ jobs:
2121
security-events: write
2222

2323
steps:
24-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25-
with:
24+
- name: Harden Runner
25+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
26+
with:
27+
egress-policy: audit
28+
29+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
30+
with:
2631
fetch-depth: 0
2732

28-
- name: Initialize CodeQL
29-
uses: github/codeql-action/init@014f16e7ab1402f30e7c3329d33797e7948572db # v4.31.3
30-
with:
31-
languages: 'csharp'
32-
debug: true
33+
- name: Initialize CodeQL
34+
uses: github/codeql-action/init@014f16e7ab1402f30e7c3329d33797e7948572db # v4.31.3
35+
with:
36+
languages: "csharp"
37+
debug: true
3338

34-
- name: Autobuild
35-
uses: github/codeql-action/autobuild@014f16e7ab1402f30e7c3329d33797e7948572db # v4.31.3
39+
- name: Autobuild
40+
uses: github/codeql-action/autobuild@014f16e7ab1402f30e7c3329d33797e7948572db # v4.31.3
3641

37-
- name: Perform CodeQL Analysis
38-
uses: github/codeql-action/analyze@014f16e7ab1402f30e7c3329d33797e7948572db # v4.31.3
42+
- name: Perform CodeQL Analysis
43+
uses: github/codeql-action/analyze@014f16e7ab1402f30e7c3329d33797e7948572db # v4.31.3

.github/workflows/detector-version-bump-reminder.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@ name: "Detector version bump reminder"
22
on:
33
push:
44
paths:
5-
- 'src/Microsoft.ComponentDetection.Detectors/**'
6-
5+
- "src/Microsoft.ComponentDetection.Detectors/**"
6+
77
permissions:
88
pull-requests: write
99

1010
jobs:
1111
comment:
1212
runs-on: ubuntu-latest
1313
steps:
14+
- name: Harden Runner
15+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
16+
with:
17+
egress-policy: audit
18+
1419
- uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2
1520
with:
1621
repo-token: ${{ secrets.GITHUB_TOKEN }}
@@ -20,5 +25,5 @@ jobs:
2025
* The detector detects more or fewer components than before
2126
* The detector generates different parent/child graph relationships than before
2227
* The detector generates different `devDependencies` values than before
23-
28+
2429
If none of the above scenarios apply, feel free to ignore this comment 🙂

.github/workflows/gen-docs.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
1-
name: 'Generate docs'
1+
name: "Generate docs"
22

33
on:
44
push:
55
branches:
66
- main
77
paths:
8-
- 'src/Microsoft.ComponentDetection.Orchestrator/ArgumentSets/*.cs'
8+
- "src/Microsoft.ComponentDetection.Orchestrator/ArgumentSets/*.cs"
99

1010
permissions:
1111
contents: read
1212

1313
jobs:
1414
gen-docs:
1515
permissions:
16-
contents: write # for stefanzweifel/git-auto-commit-action to push code in repo
16+
contents: write # for stefanzweifel/git-auto-commit-action to push code in repo
1717
runs-on: ubuntu-latest
1818
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
21+
with:
22+
egress-policy: audit
23+
1924
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2025
with:
2126
fetch-depth: 0
@@ -27,12 +32,12 @@ jobs:
2732
run: |
2833
touch version.json
2934
touch version_dev.json
30-
35+
3136
# Run CLI
3237
dotnet run -p src/Microsoft.ComponentDetection help scan 2> help.txt || true
3338
cat <<EOF > docs/detector-arguments.md
3439
# Detector arguments
35-
40+
3641
\`\`\`shell
3742
dotnet run -p './src/Microsoft.ComponentDetection' help scan
3843
\`\`\`
@@ -45,5 +50,5 @@ jobs:
4550
- name: Commit
4651
uses: stefanzweifel/git-auto-commit-action@28e16e81777b558cc906c8750092100bbb34c5e3 # v7.0.0
4752
with:
48-
commit_message: 'Update docs'
49-
file_pattern: '*.md'
53+
commit_message: "Update docs"
54+
file_pattern: "*.md"

.github/workflows/ossf-scorecard.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ on:
1010
# To guarantee Maintained check is occasionally updated. See
1111
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
1212
schedule:
13-
- cron: '44 3 * * 5'
13+
- cron: "44 3 * * 5"
1414
push:
15-
branches: [ "main" ]
15+
branches: ["main"]
1616

1717
# Declare default permissions as read only.
1818
permissions: read-all
@@ -31,6 +31,11 @@ jobs:
3131
# actions: read
3232

3333
steps:
34+
- name: Harden Runner
35+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
36+
with:
37+
egress-policy: audit
38+
3439
- name: "Checkout code"
3540
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3641
with:

.github/workflows/release-drafter.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ jobs:
1616
pull-requests: read
1717
runs-on: ubuntu-latest
1818
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
21+
with:
22+
egress-policy: audit
23+
1924
- uses: release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5 # v6
2025
with:
2126
disable-autolabeler: true

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ jobs:
2121
MINVERBUILDMETADATA: build.${{github.run_number}}
2222

2323
steps:
24+
- name: Harden Runner
25+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
26+
with:
27+
egress-policy: audit
28+
2429
- name: Checkout repository
2530
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2631
with:

.github/workflows/smoke-test.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,15 @@ jobs:
3838
max-parallel: 4 # limit the total number of running jobs to avoid rate limiting
3939
name: ${{ matrix.language.name }}
4040
steps:
41+
- name: Harden Runner
42+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
43+
with:
44+
egress-policy: audit
45+
4146
- name: Checkout Component Detection
4247
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4348

44-
- name: Prepare Dotnet
49+
- name: Prepare Dotnet
4550
run: |
4651
# When using a Vanilla Ubuntu image, GH Actions may not have access to the /usr/share/dotnet directory.
4752
sudo mkdir /usr/share/dotnet
@@ -85,6 +90,11 @@ jobs:
8590
permissions:
8691
issues: write
8792
steps:
93+
- name: Harden Runner
94+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
95+
with:
96+
egress-policy: audit
97+
8898
- name: Create GitHub Issue
8999
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
90100
with:

.github/workflows/snapshot-publish.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ jobs:
2323
os: [ubuntu-latest, windows-latest, macos-latest]
2424

2525
steps:
26+
- name: Harden Runner
27+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
28+
with:
29+
egress-policy: audit
30+
2631
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2732

2833
- name: Setup .NET Core
@@ -33,7 +38,7 @@ jobs:
3338
- name: Setup Python
3439
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
3540
with:
36-
python-version: '3.10'
41+
python-version: "3.10"
3742

3843
- name: Install Apache Ivy
3944
if: ${{ matrix.os == 'ubuntu-latest' }}

.github/workflows/snapshot-verify.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ jobs:
1919
os: [ubuntu-latest, windows-latest, macos-latest]
2020

2121
steps:
22+
- name: Harden Runner
23+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
24+
with:
25+
egress-policy: audit
26+
2227
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2328

2429
- name: Make release snapshot output directory
@@ -57,7 +62,7 @@ jobs:
5762
- name: Setup Python
5863
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6
5964
with:
60-
python-version: '3.10'
65+
python-version: "3.10"
6166

6267
- run: dotnet restore
6368

0 commit comments

Comments
 (0)