NJsonSchema icon indicating copy to clipboard operation
NJsonSchema copied to clipboard

Require upgrade Newtonsoft.Json for high severity security issue

Open iamzhaoxu opened this issue 2 years ago • 2 comments

According to the https://github.com/advisories/GHSA-5crp-9r3c-p9vr, the current version (9.0.1) of Newtonsoft.Json used in NJsonSchema has a high-risk vulnerability

Can we upgrade the Newtonsoft.Json in NJsonSchema to resolve the issue?

iamzhaoxu avatar Oct 20 '22 06:10 iamzhaoxu

hi, I think you should completely abandon Newtonsoft.Json, now it is considered old and has low performance. Instead use System.Text.Json

alexeygritsenko avatar Oct 30 '22 07:10 alexeygritsenko

Before abandon Newtonsoft.Json it would help to consolidate all references to the newest version used by all packages, which also includes NSwag. There are environments (VSIX extension for VS2017) where you can't reference both 9.0.1 and newer versions of Newtonsoft.Json at the same time by different libraries which also do reference each other, like NSwag and NJsonSchema does. Microsoft recommends to not use [ProvideBindingRedirection] for Newtonsoft.Json, because older versions are used by core components of Visual Studio itself. See this blog post. If all packages would reference the same new version of Newtonsoft.Json there would be no problem in loading them from the extension folder.

There are already 2 open pull requests for this purpose: #1531 RicoSuter/NSwag#4054

Please merge them into master.

matherm-aboehm avatar May 02 '23 13:05 matherm-aboehm