Skip to content

Move MailKit and Newtonsoft.Json to patched versions - #395

Open
auscaster wants to merge 1 commit into
lukencode:masterfrom
auscaster:patched-mailkit-and-newtonsoft
Open

auscaster wants to merge 1 commit into
lukencode:masterfrom
auscaster:patched-mailkit-and-newtonsoft

Conversation

@auscaster

Copy link
Copy Markdown

Fixes #296.

With the .NET 10 SDK, dotnet build FluentEmail.sln fails on master. NuGet audit reports two vulnerable dependencies, and the repo treats warnings as errors:

  • MailKit 2.10.1 in FluentEmail.MailKit: GHSA-9j88-vvj5-vhgr (STARTTLS response injection allowing a SASL downgrade), fixed in 4.16.0
  • Newtonsoft.Json 12.0.3 in FluentEmail.Mailgun: GHSA-5crp-9r3c-p9vr, fixed in 13.0.1

This moves them to MailKit 4.18.2 and Newtonsoft.Json 13.0.4. MailKitSender compiles against MailKit 4 without changes, and both still target netstandard2.0.

It also fixes #296. FluentEmail.MailKit was compiled against MailKit 2.x, whose SendAsync returned Task, so an app that moved to MailKit 3 or later got a MissingMethodException at send time. Compiled against 4.18, it binds to the current signature.

How I checked it:

  • The solution builds on the .NET 10 SDK with no errors.
  • The test projects target netcoreapp3.1, which has no test host on Apple silicon, so I ran them retargeted to net10.0 locally (that change isn't in this PR). Liquid 9/9 and Razor 7/7 pass. In Core, the four MailKit tests pass. The six MailgunSenderTests that call the live Mailgun API fail exactly as they do on master with the old versions.
  • The MailKit tests only use pickup-directory mode, so I also sent a message over SMTP through MailKitSender on MailKit 4.18 to a local server, and it arrived.

MailKit 2.10.1 is affected by GHSA-9j88-vvj5-vhgr (fixed in 4.16.0) and
Newtonsoft.Json 12.0.3 by GHSA-5crp-9r3c-p9vr (fixed in 13.0.1). With the
.NET 10 SDK, NuGet audit reports both and the solution fails to build. The
MailKit sender now references MailKit 4.18.2 and the Mailgun sender
Newtonsoft.Json 13.0.4. MailKitSender compiles against MailKit 4 unchanged.

Building against MailKit 4 also binds SendAsync to its current signature,
which fixes the MissingMethodException apps on MailKit 3 or later hit.

Fixes lukencode#296
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.

System.MissingMethodException when using MailKit 3.0.0

1 participant