Skip to content

Commit d612ab8

Browse files
authored
Harden dependency and release supply chains (#11)
- lock NuGet dependency graphs - add deterministic hostile-input property tests - stage and attest exact packages before OIDC publication - make GitHub and NuGet release recovery fail-safe
1 parent 56f61b5 commit d612ab8

26 files changed

Lines changed: 5136 additions & 28 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
2222
with:
2323
dotnet-version: 8.0.x
24+
dotnet-quality: ga
2425

2526
# setup-dotnet proves installation, while global.json controls selection. Assert the actual
2627
# resolver result because hosted runners also have newer SDK majors preinstalled.
@@ -35,7 +36,7 @@ jobs:
3536
fi
3637
3738
- name: Restore
38-
run: dotnet restore -p:NuGetAuditMode=all -warnaserror
39+
run: dotnet restore --locked-mode -p:NuGetAuditMode=all -warnaserror
3940

4041
# Hard gate: the project keeps a zero-warning build, so fail CI on any warning.
4142
- name: Build
@@ -147,6 +148,7 @@ jobs:
147148
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
148149
with:
149150
dotnet-version: 8.0.x
151+
dotnet-quality: ga
150152

151153
- name: Verify .NET 8 SDK selection
152154
shell: bash
@@ -159,7 +161,7 @@ jobs:
159161
fi
160162
161163
- name: Restore and audit dependencies
162-
run: dotnet restore -p:NuGetAuditMode=all -warnaserror
164+
run: dotnet restore --locked-mode -p:NuGetAuditMode=all -warnaserror
163165

164166
- name: Pack and validate public API
165167
run: dotnet pack src/SolSharp/SolSharp.csproj -c Release -o artifacts -p:Version=999.0.0-ci --no-restore -warnaserror

‎.github/workflows/codeql.yml‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ on:
1111

1212
permissions:
1313
contents: read
14-
security-events: write
1514

1615
jobs:
1716
analyze:
1817
name: analyze-csharp
1918
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
security-events: write
2022
steps:
2123
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2224
with:
@@ -32,9 +34,20 @@ jobs:
3234
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
3335
with:
3436
dotnet-version: 8.0.x
37+
dotnet-quality: ga
38+
39+
- name: Verify .NET 8 SDK selection
40+
shell: bash
41+
run: |
42+
selected_version="$(dotnet --version)"
43+
if [[ "${selected_version}" != 8.* ]]; then
44+
echo "Expected a .NET 8 SDK, but dotnet selected ${selected_version}."
45+
dotnet --info
46+
exit 1
47+
fi
3548
3649
- name: Restore
37-
run: dotnet restore -p:NuGetAuditMode=all -warnaserror
50+
run: dotnet restore --locked-mode -p:NuGetAuditMode=all -warnaserror
3851

3952
- name: Build for CodeQL
4053
run: dotnet build --no-restore --configuration Release -warnaserror

0 commit comments

Comments
 (0)