Fix Dependabot alerts, modernize sample dependencies, drop EOL SDK installs#1357
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses Dependabot security alerts in the repository’s sample projects by ensuring patched versions of vulnerable transitive dependencies are resolved under Central Package Management (CPM).
Changes:
- Add explicit
PackageReferenceentries in affected sample.csprojfiles to force resolution of patched transitive packages. - Add a CPM
PackageVersionentry forSystem.Drawing.Commonat4.7.3so samples can reference it without per-project versioning. - Preserve the older
Microsoft.Azure.DurableTask.AzureStorage1.x dependency in the Managed Identity sample while overriding its vulnerable transitives.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Directory.Packages.props | Adds CPM version entry for System.Drawing.Common to support patched dependency resolution. |
| samples/Correlation.Samples/Correlation.Samples.csproj | Adds explicit reference to System.Text.RegularExpressions to override a vulnerable transitive. |
| samples/DistributedTraceSample/ApplicationInsights/ApplicationInsightsSample.csproj | Adds explicit references to System.Drawing.Common and System.Text.Json to override vulnerable transitives. |
| samples/ManagedIdentitySample/DTFx.AzureStorage v1.x/ManagedIdentity.AzStorageV1.csproj | Adds explicit references to System.Net.Http and System.Text.RegularExpressions to override vulnerable transitives from older dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
21d33e6 to
a36db78
Compare
|
Addressed the review feedback and broadened the scope per request:
Intentionally not modernized:
Verified: all 6 samples + 4 src libraries + 3 test projects build with 0 warnings, 0 errors, and The failing |
a36db78 to
d47f7e1
Compare
CI fix: removed EOL .NET Core 2.1 / 3.1 SDK installs from the PR validation pipelineThe previously failing Why the 2.1 / 3.1 installs are safe to drop
Change
CI is re-running on |
d47f7e1 to
008f203
Compare
5295d08 to
9c2853e
Compare
…stalls Resolves all 5 open Dependabot alerts (all transitive deps in samples/), modernizes outdated sample dependencies, and removes EOL .NET Core SDK installs from the public PR validation pipeline. Dependabot alerts fixed (all in samples/): - GHSA-cmhx-cq75-c4mj System.Text.RegularExpressions 4.3.0 -> 4.3.1 - GHSA-7jgj-8wvc-jh57 System.Net.Http 4.3.0 -> 4.3.4 - GHSA-8g4q-xg66-9fp4 System.Text.Json 6.0.0 -> 10.0.8 - GHSA-rxg9-xrhp-64gj System.Drawing.Common 4.7.0 -> 6.0.0 (eliminated via WorkerService 2.21 -> 2.23 upgrade; no explicit pin) Sample dependency modernization (Directory.Packages.props): - Azure.Identity 1.18.0 -> 1.21.0 - Azure.Monitor.OpenTelemetry.Exporter 1.6.0 -> 1.8.1 - Microsoft.ApplicationInsights.DependencyCollector 2.12.0 -> 2.23.0 - Microsoft.ApplicationInsights.WorkerService 2.21.0 -> 2.23.0 - Microsoft.Extensions.Azure 1.7.4 -> 1.14.0 - Microsoft.Extensions.Configuration 3.1.32 -> 10.0.8 - Microsoft.Extensions.Configuration.Json 3.1.32 -> 10.0.8 - Microsoft.Extensions.Hosting 6.0.1 -> 10.0.8 - OpenTelemetry.Exporter.Console 1.1.0 -> 1.15.3 - OpenTelemetry.Exporter.Zipkin (deprecated) replaced by OpenTelemetry.Exporter.OpenTelemetryProtocol 1.15.3 - System.Text.Json 10.0.3 -> 10.0.8 - Vio.DurableTask.Hosting 2.2.1 -> 2.2.17 - ncrontab (net48) 1.0.0 -> 3.4.0 Code changes: - OpenTelemetrySample/Program.cs: migrate deprecated AddZipkinExporter to AddOtlpExporter. - Correlation.Samples/TelemetryActivator.cs: migrate from obsolete TelemetryConfiguration.InstrumentationKey to ConnectionString (APPLICATIONINSIGHTS_CONNECTION_STRING) with backward-compat fallback to the legacy APPINSIGHTS_INSTRUMENTATIONKEY env var. CI fix (eng/templates/build-steps.yml): - Remove the .NET Core 2.1 and 3.1 SDK install steps. Both runtimes are long EOL (2021 and 2022); no project in the repo targets netcoreapp2.x or netcoreapp3.x, and the 2.1 release-index endpoint has become unreliable, causing intermittent TLS failures that fail the entire PR validation pipeline (e.g., build #279849 'DTFxCoreValidate Validate 11'). Builds use VSBuild/MSBuild and the only SDK actually required is .NET 8 for the net8.0 test targets. Intentionally not modernized: - Microsoft.Azure.DurableTask.AzureStorage 1.17.3 in ManagedIdentity v1.x (educational pin to demonstrate v1.x usage). - EnterpriseLibrary.SemanticLogging, CommandLineParser 1.x in DurableTask.Samples (abandoned / breaking API changes). - Microsoft.ApplicationInsights 2.x -> 3.x (major version, out of scope). Verified: all 6 sample projects, all 4 src libraries, and all 3 test projects build with 0 warnings and 0 errors. 'dotnet list package --include-transitive' confirms no vulnerable transitive versions remain in any sample's resolved graph. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9c2853e to
acac1dc
Compare
Summary
Three related cleanups for the
samples/projects and the public PR validation pipeline:Dependabot alerts fixed
System.Drawing.Commonis resolved by bumpingMicrosoft.ApplicationInsights.WorkerServicefrom 2.21.0 → 2.23.0, which bringsDrawing.Common 6.0.0transitively — outside the only known vulnerable ranges (4.x < 4.7.2and5.x < 5.0.3). No explicit reference or CPM entry is needed.Sample dependency modernization (
Directory.Packages.props)Code changes
samples/DistributedTraceSample/OpenTelemetry/Program.cs: migrate deprecatedAddZipkinExporter()→AddOtlpExporter()(Zipkin exporter package replaced).samples/Correlation.Samples/TelemetryActivator.cs: migrate from obsoleteTelemetryConfiguration.InstrumentationKeytoConnectionString(APPLICATIONINSIGHTS_CONNECTION_STRING) with backward-compat fallback to the legacyAPPINSIGHTS_INSTRUMENTATIONKEYenv var.samples/DistributedTraceSample/ApplicationInsights/ApplicationInsightsSample.csproj: removed staleSystem.Diagnostics.DiagnosticSource VersionOverride="7.0.2"workaround (no longer needed once Hosting is on 10.x).CI fix (
eng/templates/build-steps.yml)Removed the two
UseDotNet@2steps that installed .NET Core 2.1 and .NET Core 3.1 SDKs. Both runtimes are long EOL (Aug 2021 and Dec 2022); no project in the repo targetsnetcoreapp2.xornetcoreapp3.x. The 2.1 release-index endpoint has become unreliable, producing intermittent TLS handshake failures that fail the whole PR validation pipeline (e.g., build #279849DTFxCoreValidate Validate 11):Builds use VSBuild/MSBuild, and the only SDK actually required is .NET 8 for the
net8.0test targets. The official build pipeline (eng/ci/official-build.yml) doesn't install these SDKs either.Intentionally not modernized
Microsoft.Azure.DurableTask.AzureStorage 1.17.3in ManagedIdentity v1.x (educational pin to demonstrate v1.x usage).EnterpriseLibrary.SemanticLogging/CommandLineParser 1.xin DurableTask.Samples (abandoned / breaking API changes).Microsoft.ApplicationInsights 2.x → 3.x(major version, out of scope).Verification
dotnet list package --include-transitiveon each affected sample confirms no vulnerable transitive versions remain.