-
Notifications
You must be signed in to change notification settings - Fork 494
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
Updated Newtonsoft.Json from 10.0.2 to latest to fix security vulnerability. #4395
Conversation
… 24 Apr 2022. Ref: CVE-2024-21907 and CWE-755.
…es introduced on 24 Apr 2022. Ref: CVE-2024-21907 and CWE-755.
@@ -118,7 +118,7 @@ | |||
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" /> | |||
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0" /> | |||
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="16.0.102" PrivateAssets="All" /> | |||
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" NoWarn="NU1903" /> | |||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" NoWarn="NU1903" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This upgrade cannot be made because dependency upgrades with major version difference are considered breaking. And this would require a new major version of the SDK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FabianMeiswinkel Alright. Makes sense.
Is there any plan to make those updates?
This project also relies on vulnerable versions of System.Net.Http, and System.Text.RegularExpressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This upgrade cannot be made (at least in production code Microsoft.Azure.Cosmos and Microsoft.Azure.Cosmos.Encryption) because dependency upgrades with major version difference are considered breaking. And this would require a new major version of the SDK.
Considering the point made by @FabianMeiswinkel, I'm closing this PR, since it wouldn't make much sense to update some, but not all the package versions, because the overall project would still be left vulnerable, and still generate alerts by code analyzers (such as Snyk, and SonarCloud). |
Hi all involved, Is there a plan on how to treat vulnerable dependency versions? To be frank, I am not sure why would a major dependency version upgrade mean also a major release for the SDK. But besides this point, Newtonsoft.Json does not really adhere to the semver, as its minor version is always "0". So upgrading from 10.0.2 to 13.0.3 is not a major version upgrade in a semver sense. |
@RockyMM the problem is that between 10.0.2 and 13, there were breaking changes in Newtonsoft.Json. We cannot bump a dependency that has breaking changes on a minor version upgrade of the SDK. |
Hello, In my opinion, the problem is two-fold:
In my employer's implementation of the Cosmos library, we use system.text.json for everything rather than Newtonsoft. We also use a custom CosmosSerializer to get that to happen. But, because of this library, we still carry a needless (!) faulty version of the library in our builds. We also probably use some of those vulnerabilities from the other libraries. Granted, the code on production goes from an Azure Web App to Cosmos and back on the same region using a connectionstring acquired from a KeyVault, so I doubt anything can go wrong, but still. If possible, could it be done that a major revision will get in the works for a quick release with the intent to:
Thank you! |
We cannot upgrade the dependency to 13.0.1 because it poses breaking changes to customers. Following SemVer, the only way to push a change that creates a breaking change is to bump the Major Version, so this is only possible in a 4.X SDK, not 3.X. We already fixed the library issue, every place the library uses Newtonsoft.Json, has the MaxDepth set. So from the security perspective, the library is secured. If your application does not use Newtonsoft.Json, then based on the Security Notice, your application is secured. If there is tooling that decided to enforce nuget package versioning when the security notice clearly says that that is only one of the options, that seems to be a gap in the tooling analysis. If your application uses Newtonsoft.Json, then you can decide to either bump to 13.0.1 and address the breaking changes or use MaxDepth in the places you interact with Newtonsoft.Json. |
@ealsur Thank you for the explanation. I will relay your explanation to the team. We will review our usage of Newtonsoft.Json and do we use MaxDepth property. Still, hoping for a sooner than later release of 4.y.z SDK 🙌 |
@ealsur Thank you! That resolved my issue as well, just putting the Newtonsoft.Json most recent version together in the same assembly as where I azure Azure.Cosmos did the trick. |
Pull Request Template
Description
This project referenced an outdated version of Newtonsoft.Json (10.0.2) which had a vulnerability introduced on 24 Apr 2022.
For context, quoting the description from the nist.org page:
For consistency, other projects that also use Newtonsoft.Json were brought up to the same version.
No other changes were made to the code.
References
Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #IssueNumber