Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[repo] Mitigate vulnerabilities in System.Text.Json 8.0.0 packages #5874

Merged
merged 9 commits into from
Oct 4, 2024

Conversation

CodeBlanch
Copy link
Member

@CodeBlanch CodeBlanch commented Oct 2, 2024

Changes

  • Mitigate vulnerabilities in System.Text.Json v8.0.0 - 8.0.3

Details

ConsoleExporter and ZipkinExporter use System.Text.Json (STJ) but don't have a reference to it for net8.0+ targets. What happens is they get STJ transitively via Microsoft.NETCore.App framework reference. The final version will depend on the runtime version deployed with the app.

The problem is STJ v8.0.0 - 8.0.3 have been deprecated due to a deserialization vulnerability.

The goal here is to redirect STJ to v8.0.4 for net8.0 targets. Older targets should stay on v4.7.2. Newer targets (net9.0) will continue to use the transitive reference.

Today:

1.9.0 stable:

Target Direct reference(s) Framework reference Version Vulnerable Notes
net462 System.Text.Encodings.Web & System.Text.Json v4.7.2 No
netstandard2.0 System.Text.Encodings.Web & System.Text.Json v4.7.2 No
net6.0 System.Text.Json Runtime version (6.0.0 - 6.0.9) No Version depends on patch level of runtime
net8.0 System.Text.Json Runtime version (8.0.0 - 8.0.4) When <= 8.0.3 Version depends on patch level of runtime

1.10.0-beta.1:

Target Direct reference(s) Framework reference Version Vulnerable Notes
net462 System.Text.Encodings.Web & System.Text.Json v4.7.2 No
netstandard2.0 System.Text.Encodings.Web & System.Text.Json v4.7.2 No
net8.0 System.Text.Json Runtime version (8.0.0 - 8.0.4) When <= 8.0.3 Version depends on patch level of runtime
net9.0 System.Text.Json Runtime version (9.0.0) No No patches yet for .NET 9

Going forward:

1.9.0 stable:

No hot patch currently planned. The vulnerability is about deserialization of untrusted input which neither ConsoleExporter nor ZipkinExporter is susceptible to. I'm approaching this as a low severity issue but some work needs to be done to agree on a severity and publish an advisory. If we determine there is a higher severity we will do a hot patch for 1.9.0, possibly other releases.

Next release of 1.10.0:

Target Direct reference(s) Framework reference Version Vulnerable Notes
net462 System.Text.Encodings.Web & System.Text.Json v4.7.2 No
netstandard2.0 System.Text.Encodings.Web & System.Text.Json v4.7.2 No
net8.0 System.Text.Json v8.0.4 No
net9.0 System.Text.Json Runtime version (9.0.0) No No patches yet for .NET 9

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Appropriate CHANGELOG.md files updated for non-trivial changes

@CodeBlanch CodeBlanch requested a review from a team as a code owner October 2, 2024 04:24
@github-actions github-actions bot added infra Infra work - CI/CD, code coverage, linters dependencies Pull requests that update a dependency file documentation Documentation related pkg:OpenTelemetry.Exporter.Console Issues related to OpenTelemetry.Exporter.Console NuGet package pkg:OpenTelemetry.Exporter.Zipkin Issues related to OpenTelemetry.Exporter.Zipkin NuGet package pkg:OpenTelemetry.Api Issues related to OpenTelemetry.Api NuGet package pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package pkg:OpenTelemetry.Exporter.Prometheus.AspNetCore Issues related to OpenTelemetry.Exporter.Prometheus.AspNetCore NuGet package pkg:OpenTelemetry.Exporter.Prometheus.HttpListener Issues related to OpenTelemetry.Exporter.Prometheus.HttpListener NuGet package pkg:OpenTelemetry.Extensions.Hosting Issues related to OpenTelemetry.Extensions.Hosting NuGet package pkg:OpenTelemetry.Shims.OpenTracing Issues related to OpenTelemetry.Shims.OpenTracing NuGet package perf Performance related pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package labels Oct 2, 2024
Copy link

codecov bot commented Oct 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.32%. Comparing base (6250307) to head (d69aad3).
Report is 337 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5874      +/-   ##
==========================================
+ Coverage   83.38%   86.32%   +2.93%     
==========================================
  Files         297      257      -40     
  Lines       12531    11214    -1317     
==========================================
- Hits        10449     9680     -769     
+ Misses       2082     1534     -548     
Flag Coverage Δ
unittests ?
unittests-Project-Experimental 86.14% <ø> (?)
unittests-Project-Stable 86.28% <ø> (?)
unittests-Solution 86.16% <ø> (?)
unittests-UnstableCoreLibraries-Experimental 85.68% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 234 files with indirect coverage changes

Directory.Packages.props Outdated Show resolved Hide resolved
reyang
reyang previously requested changes Oct 3, 2024
Copy link
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several changes were made after my initial approval. The PR scope is now much bigger, I think we should focus on the mitigation and put everything else in other PRs.

@CodeBlanch
Copy link
Member Author

@reyang I reverted some of the cleanup/re-org being done in Directory.Packages.props does that reduce the scope enough or you want more reduction?

@reyang
Copy link
Member

reyang commented Oct 3, 2024

@reyang I reverted some of the cleanup/re-org being done in Directory.Packages.props does that reduce the scope enough or you want more reduction?

Nope, I see a red flag #5874 (comment).

Directory.Packages.props Outdated Show resolved Hide resolved
@reyang reyang dismissed their stale review October 4, 2024 19:24

Red flag resolved.

@CodeBlanch CodeBlanch merged commit 25d99a5 into open-telemetry:main Oct 4, 2024
49 checks passed
@CodeBlanch CodeBlanch deleted the repo-mitigate-stj-net8 branch October 4, 2024 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file documentation Documentation related infra Infra work - CI/CD, code coverage, linters perf Performance related pkg:OpenTelemetry.Api Issues related to OpenTelemetry.Api NuGet package pkg:OpenTelemetry.Exporter.Console Issues related to OpenTelemetry.Exporter.Console NuGet package pkg:OpenTelemetry.Exporter.OpenTelemetryProtocol Issues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package pkg:OpenTelemetry.Exporter.Prometheus.AspNetCore Issues related to OpenTelemetry.Exporter.Prometheus.AspNetCore NuGet package pkg:OpenTelemetry.Exporter.Prometheus.HttpListener Issues related to OpenTelemetry.Exporter.Prometheus.HttpListener NuGet package pkg:OpenTelemetry.Exporter.Zipkin Issues related to OpenTelemetry.Exporter.Zipkin NuGet package pkg:OpenTelemetry.Extensions.Hosting Issues related to OpenTelemetry.Extensions.Hosting NuGet package pkg:OpenTelemetry.Shims.OpenTracing Issues related to OpenTelemetry.Shims.OpenTracing NuGet package pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants