Skip to content

Alternative: drop net472 from Microsoft.Build.Framework to avoid vulnerable OpenTelemetry.* - #7821

Closed
mmitche wants to merge 2 commits into
dotnet:release/10.0.1xxfrom
mmitche:dev/mmitche/framework-net472-drop
Closed

mmitche wants to merge 2 commits into
dotnet:release/10.0.1xxfrom
mmitche:dev/mmitche/framework-net472-drop

Conversation

@mmitche

@mmitche mmitche commented Jul 17, 2026 •

Copy link
Copy Markdown
Member

Alternative approach: drop net472 from Microsoft.Build.Framework

This is an alternative to #7766 for resolving the NuGet audit failures (NU1902/NU1903). The novel part is how the OpenTelemetry advisory (GHSA-g94r-2vxg-569j / CVE-2026-40894) is handled: instead of upgrading OpenTelemetry.Api, drop net472 targeting.

OpenTelemetry advisory - the alternative approach

OpenTelemetry.Api is pulled in transitively by Microsoft.VisualStudio.OpenTelemetry.Collector / Microsoft.VisualStudio.OpenTelemetry.ClientExtensions, which live in the .NETFramework-only ItemGroup in Microsoft.Build.Framework.csproj. By targeting only .NET Core + netstandard2.0 (dropping net472), the vulnerable dependency is never restored - no OpenTelemetry.Api upgrade.

This sidesteps the cascade the OTel upgrade triggers in #7766: net472 MSB3277 assembly-version conflicts (System.Memory -> System.Diagnostics.DiagnosticSource), each needing frozen-maintenance-package bumps + binding-redirect updates.

Remaining audit fixes (folded in, approach-independent)

Same bumps as in #7766 so this PR resolves all reported audit failures on its own:

Trade-off / caveat

The net472 flavor of Microsoft.Build.Framework is consumed by the rest of MSBuild's net472 (Visual Studio) build. Dropping it here will break the net472 build of the rest of MSBuild, so this is offered for evaluation of the approach vs. #7766, not a drop-in change.

cc @rainersigwald

…lemetry.*

Alternative approach to fixing the NuGet audit failure (GHSA-g94r-2vxg-569j /
CVE-2026-40894) reported against the transitive OpenTelemetry.Api pulled in by
Microsoft.VisualStudio.OpenTelemetry.Collector/ClientExtensions. Those refs are
in the '.NETFramework'-only ItemGroup, so targeting only .NET Core + netstandard2.0
removes the vulnerable dependency without upgrading OpenTelemetry.Api (which would
otherwise cascade into System.Memory/DiagnosticSource assembly-version conflicts on
net472).

Trade-off: the net472 flavor of Microsoft.Build.Framework is consumed by the rest
of MSBuild's net472 (Visual Studio) build, so this is offered as an alternative to
PR dotnet#7766 for evaluation, not a drop-in change.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: bc63fc57-da4d-4945-bcfd-7a438341ffc7
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team July 17, 2026 14:45
@baronfel

Copy link
Copy Markdown
Member

I was under the impression that today VS is the primary consumer of our OTel-based metrics, via the VS-only OTel Collectors we have? If that is the case then not including OTel deps seems like it would defeat the purpose. cc @JanProvaznik

Fold in the approach-independent audit fixes so this PR resolves all reported
NU1902/NU1903 failures on its own:
- System.Security.Cryptography.Xml 9.0.0 -> 9.0.15 (GHSA-37gx-xxp4-5rgx, GHSA-w3x6-4m5h-cxqf)
- System.Formats.Asn1 9.0.6 -> 9.0.15
- System.Security.Cryptography.Pkcs 9.0.6 -> 9.0.15

The OpenTelemetry advisory is handled separately by dropping net472 from
Microsoft.Build.Framework (no OpenTelemetry.Api upgrade / DiagnosticSource bump).

Co-authored-by: Copilot <[email protected]>
Copilot-Session: bc63fc57-da4d-4945-bcfd-7a438341ffc7
@mmitche

mmitche commented Jul 17, 2026 •

Copy link
Copy Markdown
Member Author

I was under the impression that today VS is the primary consumer of our OTel-based metrics, via the VS-only OTel Collectors we have? If that is the case then not including OTel deps seems like it would defeat the purpose. cc @JanProvaznik

VS 18.0 isn't in support any longer, and we don't include the net framework version of msbuild in the SDK (I think)

@JanProvaznik

JanProvaznik commented Jul 17, 2026 •

Copy link
Copy Markdown
Member

I don't like this because if we needed to service 18.0 nugets (still 2+ years in support IIRC) the net472 should remain inside even though that VS is out of support. But I am not sure what's our exact support contract with nugets.

@JanProvaznik

JanProvaznik commented Jul 17, 2026 •

Copy link
Copy Markdown
Member

and @baronfel VS is no longer the consumer because we removed otel in ~18.4

@rainersigwald

Copy link
Copy Markdown
Member

I don't like this because if we needed to service 18.0 nugets (still 2+ years in support IIRC) the net472 should remain inside even though that VS is out of support. But I am not sure what's our exact support contract with nugets.

We build & ship the NuGet packages from our repo so we can always revive the TF and reship if we need to for a security event.

@ViktorHofer

Copy link
Copy Markdown
Member

I also don't like this approach for the stated reason but also for a another one. These change automatically flow forward to newer in support branches: vs18.0 -> vs18.6. We would need to revert these which is fine but unusual.

I would instead silence that NuGet Audit report via the NuGetAuditSuppress item in msbuild. Any other repos that are impacted should like switch to only consume the compile time asset either via PackageDownload+Reference (as runtime and roslyn do), by picking the asset directly from within the SDK or silence the warning also.

@mmitche

mmitche commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

I also don't like this approach for the stated reason but also for a another one. These change automatically flow forward to newer in support branches: vs18.0 -> vs18.6. We would need to revert these which is fine but unusual.

I would instead silence that NuGet Audit report via the NuGetAuditSuppress item in msbuild. Any other repos that are impacted should like switch to only consume the compile time asset either via PackageDownload+Reference (as runtime and roslyn do), by picking the asset directly from within the SDK or silence the warning also.

Is that the correct fix for OTel? I understand with the S.S.C.Xml since msbuild is only referencing surface area..but is that same thing with OTel?

@ViktorHofer

Copy link
Copy Markdown
Member

Right, that is only correct for compile-time only dependencies.

@ViktorHofer

Copy link
Copy Markdown
Member

I think stop building the TFM is a big hammer. I don't want to see that code flowing forward anywhere, accidentally. Suppressing the audit report sounds like the better option if there aren't any downstream consumers of it.

@mmitche

mmitche commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

Hmm. If we update OTel, it pulls SystemDiagnosticsDiagnosticSourcePackageVersion forward from 9.0 to 10.0.

@ViktorHofer

Copy link
Copy Markdown
Member

OTel is also just a compile time dependency, I just checked. Suppress the warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants