[CFS] Route NuGet and Cargo restores through Azure DevOps feeds - #7268
Draft
danieljurek wants to merge 9 commits into
Draft
[CFS] Route NuGet and Cargo restores through Azure DevOps feeds#7268danieljurek wants to merge 9 commits into
danieljurek wants to merge 9 commits into
Conversation
|
Azure Pipelines: Successfully started running 2 pipeline(s). 8 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Azure/azure-amqp master moved to <TargetFrameworks>net48;net10.0</TargetFrameworks>, so the net8.0 output directory referenced by Test-Setup.ps1 no longer exists and every Validate/ValidateLive job in "cpp - core" failed at "Test-Setup for azure-core-amqp". The build command was already bumped to net10.0; this aligns the Set-Location launch path with it so the broker can actually start. Both changes are marked with TODO comments to be reverted before merge - this exists only to push the build far enough forward to validate network isolation / CFS compliance. Verified locally: builds clean against azure-amqp master and produces bin/Debug/TestAmqpBroker/net10.0/TestAmqpBroker.dll, which dotnet exec loads and runs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 56d86b9d-f4b6-4b43-b37c-758f1e6ac9a3
Under the CFSClean network isolation policy api.nuget.org is blocked, which fails Test-Setup for azure-core-amqp, the coverage tools install, and the test-proxy install with NU1301 "Permission denied (api.nuget.org:443)". NuGetAuthenticate@1 does not register package sources, it only installs the Azure Artifacts Credential Provider, so authentication alone does not redirect traffic. Mirroring the cargo config fix, add an XML template that clears the inherited sources and adds the azure-sdk-for-net feed, and copy it over the user level NuGet config before NuGetAuthenticate@1 runs. The config is installed at the user level rather than in the repo because each consumer restores from a different working directory, so a repo local NuGet.config would not apply to any of them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 56d86b9d-f4b6-4b43-b37c-758f1e6ac9a3
Azure/azure-amqp ships a nuget.config that adds api.nuget.org. A repository level config takes precedence over the agent's user level config, so the clone reintroduced the source that CFSClean blocks and Test-Setup kept failing with NU1301 "Permission denied (api.nuget.org:443)" even after the user level config was pointed at the Azure Artifacts feed. Overwrite the clone's nuget.config with the same template. Verified locally by cloning azure-amqp, replacing the config, and building TestAmqpBroker against only the azure-sdk-for-net feed with a cold package cache: the feed's nuget.org upstream supplies Microsoft.CodeAnalysis.PublicApiAnalyzers and Microsoft.NETFramework.ReferenceAssemblies.net48, and the build succeeds. Note the upstream requires an authenticated identity to pull packages it has not cached yet, which NuGetAuthenticate@1 already provides in CI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 56d86b9d-f4b6-4b43-b37c-758f1e6ac9a3
Azure/azure-amqp ships a nuget.config listing api.nuget.org and dotnet-public. A repository level config takes precedence over the agent's user level config, so the clone reintroduced the source CFSClean blocks and Test-Setup failed with NU1301 "Permission denied (api.nuget.org:443)". Use dotnet nuget to remove just the nuget.org source and add the Azure SDK public feed, leaving dotnet-public in place, rather than replacing the file. Verified from a clean clone with an empty package cache: the resulting sources are dotnet-public plus azure-sdk-for-net, and TestAmqpBroker builds with no credentials. Keeping dotnet-public matters because it supplies Microsoft.CodeAnalysis.PublicApiAnalyzers and Microsoft.NETFramework.ReferenceAssemblies.net48, which the azure-sdk-for-net feed has not cached and would otherwise require an authenticated upstream pull. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 56d86b9d-f4b6-4b43-b37c-758f1e6ac9a3
The net10.0 bump was only a workaround so the core pipeline could get far enough to measure network isolation compliance. Restore the original net8.0 target and drop the TODO markers, keeping only the NuGet source change. TestAmqpBroker still fails to build because Azure/azure-amqp master targets net48 and net10.0, so net8.0 no longer exists. That break predates this branch and belongs to the owners of the azure-amqp dependency uptake. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 56d86b9d-f4b6-4b43-b37c-758f1e6ac9a3
Drop the NuGet source change from Test-Setup.ps1 so this PR does not touch the file at all. Restoring TestAmqpBroker still reaches api.nuget.org through the nuget.config shipped by the cloned Azure/azure-amqp repository, which needs to be addressed alongside the framework target by the owners of that dependency. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 56d86b9d-f4b6-4b43-b37c-758f1e6ac9a3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Routes CI package restores through Azure DevOps feeds so builds satisfy the CFSClean 1ES Network Isolation policy, instead of reaching the public internet at
api.nuget.organdcrates.io.networkIsolationPolicyis also set toPermissive, CFSCleaninarchetype-sdk-client.ymlso the policy is actually applied.Result
CFSClean is compliant in aggregate across all jobs, verified on three full pipeline runs (162 jobs total):
CFSClean does not appear for any build, and every one of the 141 measured jobs reports
CFSClean=PASS.api.nuget.orgindex.crates.iostatic.crates.iostatic.rust-lang.orgstatic.rust-lang.orgneeded no separate fix. It only ever appeared because it shares Fastly IPs with crates.io, so redirecting crates.io removed it. Confirmed by a run where the rustup toolchain download still occurred and the domain reported zero violations.Changes
Cargo
eng/templates/config.toml.template— declares theazure-sdk-for-rustregistry and a[source.crates-io] replace-withentry pointing at it.eng/pipelines/templates/steps/cmake-build.yml— copies that template to$CARGO_HOME/config.tomlbefore CMake/Corrosion invokes cargo, then runsCargoAuthenticate@0against it.An on-disk config is required because cargo does not honor environment variables for the
[source]table, and only reads config from$CARGO_HOMEor ancestors of its working directory.NuGet
eng/templates/NuGet.config.template— clears inherited package sources and adds theazure-sdk-for-netAzure Artifacts feed.eng/pipelines/templates/steps/nuget-config.yml— installs that config at the user level (%APPDATA%\NuGeton Windows,~/.nuget/NuGetotherwise), prints the resulting source list, then runsNuGetAuthenticate@1.eng/pipelines/templates/jobs/ci.tests.yml,live.tests.yml— invoke the step early, ahead of every NuGet consumer. This replaces the previous standaloneNuGetAuthenticate@1tasks, which were scoped to code coverage only.Two details worth calling out for review:
NuGet.configwould not apply to any of them.NuGetAuthenticate@1does not register package sources. It only installs the Azure Artifacts Credential Provider and binds it to feeds underpkgs.dev.azure.com/azure-sdk. Clearing sources without adding a replacement fails every restore withNU1100, so the explicit<add>is required rather than optional.Known issues owned by azure-core-amqp
sdk/core/azure-core-amqp/Test-Setup.ps1is intentionally not modified by this PR. It has two problems that should be resolved by the owners of the azure-amqp dependency uptake.1. The step is already failing in the pipelines, independently of this PR.
Azure/azure-amqpmaster now declares<TargetFrameworks>net48;net10.0</TargetFrameworks>. Thenet8.0target thatTest-Setup.ps1builds and launches no longer exists, so the step fails regardless of network isolation. Targetingnet10.0was used as a temporary local workaround to get a fully green core run for the compliance measurements above; it has been reverted and is not proposed here, because which framework to target should be a deliberate decision by the owners.2. It will still reach
api.nuget.orgonce that is fixed. The clonedAzure/azure-amqprepository ships its ownnuget.configlistingapi.nuget.organddotnet-public. A repository level config takes precedence over the user level config installed by this PR, so the clone reintroduces the blocked source and the restore fails under CFSClean with:A verified fix is to rewrite the cloned config after
git clone, swapping the nuget.org source for the Azure SDK feed while leavingdotnet-publicin place:Keeping
dotnet-publicmatters: it suppliesMicrosoft.CodeAnalysis.PublicApiAnalyzersandMicrosoft.NETFramework.ReferenceAssemblies.net48, which theazure-sdk-for-netfeed has not cached and would otherwise require an authenticated upstream pull. This was validated from a clean clone with an empty package cache, whereTestAmqpBrokerbuilds with no credentials.Out of scope
These remain non-compliant. All are
blocked=0(audit only) and none are addressable by feed redirection:www.powershellgallery.comeng/commonPowerShell bootstrap; identical in all three pipelines, so one fix covers allanglesharp.azurewebsites.netdocs.oasis-open.org,curl.se,en.cppreference.com,www.doxygen.org,datatracker.ietf.orgGenerateReleaseArtifactsmacOS jobs run on Microsoft-hosted agents rather than
azsdk-pool, so they are not instrumented by 1ES Network Isolation and could not be assessed.