Skip to content

Commit 66d115c

Browse files
bragi92Copilot
andauthored
Route NuGet restore through CFS feed (SR21 CFSClean) (#1756)
Pipeline 444 (ContainerInsights-MultiArch-MergedBranches) is flagged under MountainPass SR21 / SFI-ES4.2.4 for CFSClean violations. 1ES telemetry shows the only CFSClean endpoint hit is api.nuget.org, from dotnet.exe during the 'build base' step on build_windows_2019 and build_windows_2022. Changes: - Add NuGet.config at repo root with <clear /> and only the CFS-backed Azure Artifacts feed (microsoft_PublicPackages), which already has a NuGet Gallery upstream. Without this, restore falls back to api.nuget.org. - Drop 'dotnet add package Newtonsoft.json' and 'dotnet add package BouncyCastle' from build/windows/Makefile.ps1. Both are already pinned as PackageReference in CertificateGenerator.csproj (13.0.1 / 1.8.9); the unversioned 'dotnet add package' calls reach api.nuget.org to resolve the latest version and rewrite the csproj, un-pinning the versions at build time. - Add NuGetAuthenticate@1 to both Windows jobs so the credential provider is configured for the feed. The build shells out to dotnet from a script rather than DotNetCoreCLI@2, so nothing wires up feed auth today. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ee239d9a-59a5-409c-bf8f-5a1e5d9a9d58
1 parent 4ffa853 commit 66d115c

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

β€Ž.pipelines/azure_pipeline_mergedbranches.yamlβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ extends:
372372
displayName: 'install prereqs'
373373
- task: CodeQL3000Init@0
374374
condition: eq(variables.IS_MAIN_BRANCH, true)
375+
- task: NuGetAuthenticate@1
376+
displayName: 'Authenticate to CFS NuGet feed'
375377
- script: |
376378
setlocal enabledelayedexpansion
377379
powershell.exe -ExecutionPolicy Unrestricted -NoProfile -WindowStyle Hidden -File "build\windows\Makefile.ps1"
@@ -591,6 +593,8 @@ extends:
591593
displayName: 'install prereqs'
592594
- task: CodeQL3000Init@0
593595
condition: eq(variables.IS_MAIN_BRANCH, true)
596+
- task: NuGetAuthenticate@1
597+
displayName: 'Authenticate to CFS NuGet feed'
594598
- script: |
595599
setlocal enabledelayedexpansion
596600
powershell.exe -ExecutionPolicy Unrestricted -NoProfile -WindowStyle Hidden -File "build\windows\Makefile.ps1"

β€ŽNuGet.configβ€Ž

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<add key="PublicPackages" value="https://pkgs.dev.azure.com/github-private/microsoft/_packaging/microsoft_PublicPackages/nuget/v3/index.json" />
6+
</packageSources>
7+
</configuration>

β€Žbuild/windows/Makefile.ps1β€Ž

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,9 @@ if ($false -eq (Test-Path -Path $certsrcdir)) {
7373
Write-Host("set the cerificate generator source code directory : " + $certsrcdir + " ...")
7474
Set-Location -Path $certsrcdir
7575

76-
Write-Host("Adding dotnet packages Newtonsoft.json and BouncyCastle ...")
77-
dotnet add package Newtonsoft.json
78-
dotnet add package BouncyCastle
79-
Write-Host("Successfully added dotnet packages") -ForegroundColor Green
76+
# Newtonsoft.Json and BouncyCastle are pinned as PackageReference in CertificateGenerator.csproj.
77+
# 'dotnet add package' without a version resolves the latest from the configured source, which
78+
# reaches api.nuget.org and un-pins the versions at build time. Restore below uses NuGet.config.
8079
dotnet build -f $dotnetcoreframework
8180
Write-Host("Building Certificate generator code and ...") -ForegroundColor Green
8281

0 commit comments

Comments
Β (0)