Skip to content

Commit d16987b

Browse files
shanselmanCopilot
andcommitted
security: fix CI script injection and pin third-party actions
- Replace direct interpolation of gitversion semVer output in run: block with env var to prevent script injection - Pin gittools/actions to e0d584e (v4) - Pin azure/login to a457da9 (v2) - Pin azure/trusted-signing-action to db7a3a6 (v1) - Pin softprops/action-gh-release to 153bb8e (v2) - Pin rustsec/audit-check to 69366f3 (v2) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 95d458c commit d16987b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,20 @@ jobs:
3535
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
3636

3737
- name: Install GitVersion
38-
uses: gittools/actions/gitversion/setup@v4
38+
uses: gittools/actions/gitversion/setup@e0d584e657c606912e8fd522aeed29025975705f # v4
3939
with:
4040
versionSpec: '6.4.x'
4141

4242
- name: GitVersion
43-
uses: gittools/actions/gitversion/execute@v4
43+
uses: gittools/actions/gitversion/execute@e0d584e657c606912e8fd522aeed29025975705f # v4
4444
id: gitversion
4545

4646
- name: Set version
4747
shell: pwsh
48+
env:
49+
SEMVER: ${{ steps.gitversion.outputs.semVer }}
4850
run: |
49-
$version = '${{ steps.gitversion.outputs.semVer }}'
51+
$version = $env:SEMVER
5052
Write-Host "Version: $version"
5153
echo "VERSION=$version" >> $env:GITHUB_ENV
5254
@@ -58,13 +60,13 @@ jobs:
5860

5961
- name: Azure Login
6062
if: startsWith(github.ref, 'refs/tags/')
61-
uses: azure/login@v2
63+
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2
6264
with:
6365
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'
6466

6567
- name: Sign executables with Trusted Signing
6668
if: startsWith(github.ref, 'refs/tags/')
67-
uses: azure/trusted-signing-action@v1
69+
uses: azure/trusted-signing-action@db7a3a6bd3912025c705162fb7475389f5b69ec6 # v1
6870
with:
6971
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
7072
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
@@ -108,7 +110,7 @@ jobs:
108110
merge-multiple: true
109111

110112
- name: Create Release
111-
uses: softprops/action-gh-release@v2
113+
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
112114
with:
113115
files: artifacts/*.exe
114116
generate_release_notes: true

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ jobs:
4343
runs-on: ubuntu-latest
4444
steps:
4545
- uses: actions/checkout@v4
46-
- uses: rustsec/audit-check@v2
46+
- uses: rustsec/audit-check@69366f33c96575abad1ee0dba8212993eecbe998 # v2
4747
with:
4848
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)