Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[StepSecurity] ci: Harden GitHub Actions #4226

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/_artifacts_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ jobs:
targetFramework: [ '6.0', '8.0' ]

steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/_artifacts_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ jobs:
package: [ Executable, MsBuildFull ]

steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ jobs:

runs-on: ${{ matrix.os }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,36 @@ jobs:
targetFramework: [ '6.0', '8.0' ]

steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
-
name: Restore State
uses: ./.github/actions/artifacts-restore
-
uses: actions/download-artifact@v4
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
name: Download nuget packages
with:
name: nuget
path: ${{ github.workspace }}/artifacts/packages/nuget
-
name: Set up Docker
uses: crazy-max/ghaction-setup-docker@v3
uses: crazy-max/ghaction-setup-docker@78318f8be53384b971671f27d81f5e72526c102d # v3.3.0
with:
daemon-config: '{ "features": { "containerd-snapshotter": true } }'
-
name: Setup QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
-
name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
with:
version: 'latest'
driver-opts: 'image=moby/buildkit:buildx-stable-1'
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/_docker_manifests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ jobs:
targetFramework: [ '6.0', '8.0' ]

steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/_prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ jobs:

runs-on: ${{ matrix.os }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jobs:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ jobs:

runs-on: ${{ matrix.os }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ jobs:
language: [ 'csharp' ]

steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ jobs:
os: [windows-latest, ubuntu-latest]

steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -93,6 +98,11 @@ jobs:
needs: [ prepare ]
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -132,6 +142,11 @@ jobs:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ github.actor }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ jobs:
runs-on: ubuntu-latest
name: DotNet Format
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/homebrew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jobs:
name: Bump Homebrew formula
runs-on: macos-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

- name: Get version
id: get-version
shell: pwsh
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
name: Update Markdown (embedded snippets)
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ jobs:
name: Trigger ci flow
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

-
name: Checkout
uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

- uses: actions/stale@v9
with:
operations-per-run: 100
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/winget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jobs:
name: Bump winget manifest
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit

- name: Get version
id: get-version
shell: pwsh
Expand Down