Skip to content

Commit 4c6191e

Browse files
authored
Merge pull request #12 from SamErde/chore/GHA-052020-stepsecurity-remediation
[StepSecurity] Apply security best practices
2 parents 238245a + 70c77f2 commit 4c6191e

File tree

4 files changed

+31
-7
lines changed

4 files changed

+31
-7
lines changed

.github/workflows/GitGuardian.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ jobs:
99
name: GitGuardian Scan
1010
runs-on: ubuntu-latest
1111
steps:
12+
- name: Harden the runner (Audit all outbound calls)
13+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
14+
with:
15+
egress-policy: audit
16+
1217
- name: Checkout
13-
uses: actions/checkout@v4
18+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
1419
with:
1520
fetch-depth: 0 # fetch all history so multiple commits can be scanned
1621
- name: GitGuardian Scan
17-
uses: GitGuardian/ggshield/actions/[email protected]
22+
uses: GitGuardian/ggshield/actions/secret@e4f45829b9b6f4664fe70d2a4dcd307a6833f422 # v1.43.0
1823
env:
1924
GITHUB_PUSH_BEFORE_SHA: ${{ github.event.before }}
2025
GITHUB_PUSH_BASE_SHA: ${{ github.event.base }}

.github/workflows/MegaLinter.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ concurrency:
1818
group: ${{ github.ref }}-${{ github.workflow }}
1919
cancel-in-progress: true
2020

21+
permissions:
22+
contents: read
23+
2124
jobs:
2225
megalinter:
2326
name: MegaLinter
@@ -33,8 +36,13 @@ jobs:
3336
steps:
3437

3538
# Git Checkout
39+
- name: Harden the runner (Audit all outbound calls)
40+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
41+
with:
42+
egress-policy: audit
43+
3644
- name: Checkout Code
37-
uses: actions/checkout@v4
45+
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
3846
with:
3947
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
4048

@@ -47,7 +55,7 @@ jobs:
4755

4856
# You can override MegaLinter flavor used to have faster performances
4957
# More info at https://megalinter.io/flavors/
50-
uses: oxsecurity/megalinter/flavors/dotnet@v8
58+
uses: oxsecurity/megalinter/flavors/dotnet@e08c2b05e3dbc40af4c23f41172ef1e068a7d651 # v8.8.0
5159

5260
id: ml
5361

@@ -87,7 +95,7 @@ jobs:
8795

8896
# Upload MegaLinter artifacts
8997
- name: Archive production artifacts
90-
uses: actions/upload-artifact@v4
98+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
9199
if: success() || failure()
92100
with:
93101
name: MegaLinter reports

.github/workflows/PSScriptAnalyzer.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ jobs:
1919
name: 🕵️‍♂️ PSScriptAnalyzer
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@v4
22+
- name: Harden the runner (Audit all outbound calls)
23+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
24+
with:
25+
egress-policy: audit
26+
27+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
2328

2429
- name: 🕵️‍♂️ Run PSScriptAnalyzer
2530
uses: microsoft/psscriptanalyzer-action@6b2948b1944407914a58661c49941824d149734f
@@ -34,6 +39,6 @@ jobs:
3439

3540
# Upload the SARIF file generated in the previous step
3641
- name: ⬆️ Upload SARIF results file
37-
uses: github/codeql-action/upload-sarif@v3
42+
uses: github/codeql-action/upload-sarif@5d5cd550d3e189c569da8f16ea8de2d821c9bf7a # v3.31.2
3843
with:
3944
sarif_file: results.sarif

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: end-of-file-fixer
6+
- id: trailing-whitespace

0 commit comments

Comments
 (0)