Update NuGet dependencies and compatibility
What changed, and why it matters
This commit updates many third-party software libraries (NuGet packages) to newer versions and makes small code adjustments so BTCPay Server stays compatible with those updates. The most notable security-relevant change is a rewrite of the wallet transaction CSV export. The new code deliberately prefixes spreadsheet formula characters (like =, +, @) with an apostrophe so that exported CSV files are less likely to trigger malicious formula injection when opened in Excel or similar programs. The commit does not say it is fixing a security bug, and no external advisory is supplied.
Treat as a maintenance/dependency update with a likely security-hardening side effect in CSV export. Review the new EscapeCsvMetadata logic for completeness (e.g., it does not escape leading 0x0D/0x0A after trimming, only checks raw first char; verify coverage of all formula-injection vectors). Validate that the Fido2 AppID removal does not weaken phishing-resistant authentication for existing credentials. Apply normal dependency-update testing; no emergency response is indicated by the diff alone.
Security signals we found
Dependency version bumps for libraries with known security maintenance value (HtmlSanitizer, Fido2, MailKit, Microsoft.AspNetCore, System.Security.Cryptography.Pkcs)
Manual CSV field escaping added to prevent formula/CSV injection in wallet transaction exports
Fido2 configuration/AppID handling changed during Fido2 library upgrade
MailKit 5.0.0 breaking API changes adapted (SmtpCapabilities → SmtpCapability, response.ResponseText)
Evidence from the diff
The diff is primarily a routine dependency bump (Microsoft.AspNetCore.* 10.0.14→10.0.15, NBitcoin 10.0.19→10.0.20, Fido2 4.3.1→4.3.2, MailKit 4.18.2→5.0.0, HtmlSanitizer 9.2.1039→11.0.26, CsvHelper 33.1.0→34.0.0, etc.) with compatibility code changes. Security-relevant code changes include: (1) TransactionsExport.cs replaces CsvHelper’s auto-mapped class writer with a manual writer and adds EscapeCsvMetadata(), which prepends a single quote to fields beginning with tab/newline or formula-triggering characters (including fullwidth variants). This is a CSV injection / formula-injection mitigation. (2) Fido2Service.cs removes the Fido2Configuration dependency and the AppID extension set to _fido2Configuration.Origins.First(), which may be a compatibility change with Fido2 4.3.2. (3) Email code adapts to MailKit 5.0.0 API changes (SmtpCapabilities enum → SmtpCapability flags class, response → response.ResponseText). No CVE, vendor security statement, or researcher attribution is present in the supplied materials.
Changed components
BTCPayServer/Services/Wallets/Export/TransactionsExport.csBTCPayServer/Fido2/Fido2Service.csBTCPayServer/Plugins/Emails/Services/EmailSender.csBTCPayServer/Plugins/Emails/Services/EmailSettings.csBTCPayServer/Plugins/Emails/Controllers/UIEmailControllerBase.csProject NuGet package references across BTCPayServer.*.csproj filesInspect captured patch +55 / −44
### BTCPayServer.Abstractions/BTCPayServer.Abstractions.csproj
@@ -22,7 +22,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Release' ">
- <PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.402" PrivateAssets="All" />
+ <PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.404" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
@@ -31,9 +31,9 @@
<None Include="icon.png" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
- <PackageReference Include="HtmlSanitizer" Version="9.2.1039" />
- <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="10.0.14" />
- <PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.14" />
+ <PackageReference Include="HtmlSanitizer" Version="11.0.26" />
+ <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="10.0.15" />
+ <PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.15" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.3" />
</ItemGroup>
<ItemGroup>
### BTCPayServer.Client/BTCPayServer.Client.csproj
@@ -27,11 +27,11 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Release' ">
- <PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.402" PrivateAssets="All" />
+ <PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.404" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BTCPayServer.Lightning.Common" Version="1.7.5" />
- <PackageReference Include="NBitcoin" Version="10.0.19" />
+ <PackageReference Include="NBitcoin" Version="10.0.20" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
<ItemGroup>
### BTCPayServer.Data/BTCPayServer.Data.csproj
@@ -3,14 +3,14 @@
<Import Project="../Build/Common.csproj" />
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
- <PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.14" />
- <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.14">
+ <PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.15" />
+ <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.15">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
- <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.14" />
- <PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.14" />
- <PackageReference Include="NBitcoin.Altcoins" Version="6.0.11" />
+ <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.15" />
+ <PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.15" />
+ <PackageReference Include="NBitcoin.Altcoins" Version="6.0.12" />
<PackageReference Include="Dapper" Version="2.1.89" />
</ItemGroup>
<ItemGroup>
### BTCPayServer.Rating/BTCPayServer.Rating.csproj
@@ -6,7 +6,7 @@
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="5.9.0" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="6.0.0" />
- <PackageReference Include="NBitcoin" Version="10.0.19" />
+ <PackageReference Include="NBitcoin" Version="10.0.20" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="DigitalRuby.ExchangeSharp" Version="1.2.1" />
</ItemGroup>
### BTCPayServer.Tests/BTCPayServer.Tests.csproj
@@ -44,8 +44,8 @@
<PackageReference Include="Microsoft.Playwright" Version="1.64.1" />
<PackageReference Include="Microsoft.Testing.Extensions.GitHubActionsReport" Version="2.5.2" />
<PackageReference Include="Newtonsoft.Json.Schema" Version="4.0.2" />
- <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="10.0.14" />
- <PackageReference Include="xunit.v3" Version="4.0.2" />
+ <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="10.0.15" />
+ <PackageReference Include="xunit.v3" Version="4.0.3" />
<PackageReference Include="YamlDotNet" Version="18.1.0" />
</ItemGroup>
<ItemGroup>
### BTCPayServer/BTCPayServer.csproj
@@ -34,15 +34,15 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
- <PackageReference Include="NBitcoin" Version="10.0.19" />
+ <PackageReference Include="NBitcoin" Version="10.0.20" />
<PackageReference Include="BIP78.Sender" Version="0.2.5" />
<PackageReference Include="BTCPayServer.Hwi" Version="2.0.6" />
- <PackageReference Include="BTCPayServer.Lightning.All" Version="1.7.14" />
- <PackageReference Include="CsvHelper" Version="33.1.0" />
- <PackageReference Include="Fido2" Version="4.3.1" />
- <PackageReference Include="Fido2.AspNet" Version="4.3.1" />
+ <PackageReference Include="BTCPayServer.Lightning.All" Version="1.7.15" />
+ <PackageReference Include="CsvHelper" Version="34.0.0" />
+ <PackageReference Include="Fido2" Version="4.3.2" />
+ <PackageReference Include="Fido2.AspNet" Version="4.3.2" />
<PackageReference Include="LNURL" Version="0.0.36" />
- <PackageReference Include="MailKit" Version="4.18.2" />
+ <PackageReference Include="MailKit" Version="5.0.0" />
<PackageReference Include="QRCoder" Version="1.8.1" />
<PackageReference Include="NBitpayClient" Version="1.0.0.39" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
@@ -57,8 +57,8 @@
<PackageReference Include="TwentyTwenty.Storage.Azure" Version="3.0.0" />
<PackageReference Include="TwentyTwenty.Storage.Google" Version="3.0.0" />
<PackageReference Include="TwentyTwenty.Storage.Local" Version="3.0.0" />
- <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="10.0.14" />
- <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="10.0.14" />
+ <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="10.0.15" />
+ <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="10.0.15" />
</ItemGroup>
<ItemGroup>
### BTCPayServer/Fido2/Fido2Service.cs
@@ -18,13 +18,11 @@ public class Fido2Service
{
private readonly ApplicationDbContextFactory _contextFactory;
private readonly IFido2 _fido2;
- private readonly Fido2Configuration _fido2Configuration;
- public Fido2Service(ApplicationDbContextFactory contextFactory, IFido2 fido2, Fido2Configuration fido2Configuration)
+ public Fido2Service(ApplicationDbContextFactory contextFactory, IFido2 fido2)
{
_contextFactory = contextFactory;
_fido2 = fido2;
- _fido2Configuration = fido2Configuration;
}
public async Task<CredentialCreateOptions?> RequestCreation(string userId, Fido2Credential.CredentialType credType)
@@ -146,8 +144,7 @@ public async Task Remove(string id, string userId)
var exts = new AuthenticationExtensionsClientInputs()
{
UserVerificationMethod = true,
- Extensions = true,
- AppID = _fido2Configuration.Origins.First()
+ Extensions = true
};
// 3. Create options
### BTCPayServer/Plugins/Emails/Controllers/UIEmailControllerBase.cs
@@ -9,6 +9,7 @@
using BTCPayServer.Plugins.Emails.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
+using MailKit;
using MimeKit;
namespace BTCPayServer.Plugins.Emails.Controllers;
### BTCPayServer/Plugins/Emails/Services/EmailSender.cs
@@ -4,6 +4,7 @@
using BTCPayServer.Logging;
using BTCPayServer.Services;
using Microsoft.Extensions.Logging;
+using MailKit;
using MimeKit;
namespace BTCPayServer.Plugins.Emails.Services;
@@ -33,7 +34,7 @@ public void SendEmail(MailboxAddress[] email, MailboxAddress[] cc, MailboxAddres
var mail = emailSettings.CreateMailMessage(email, cc, bcc, subject, message, true);
var response = await smtp.SendAsync(mail, cancellationToken);
await smtp.DisconnectAsync(true, cancellationToken);
- EventAggregator.Publish(new Events.EmailSentEvent(response, mail));
+ EventAggregator.Publish(new Events.EmailSentEvent(response.ResponseText, mail));
}, TimeSpan.Zero);
}
### BTCPayServer/Plugins/Emails/Services/EmailSettings.cs
@@ -114,7 +114,7 @@ public async Task<SmtpClient> CreateSmtpClient()
#pragma warning restore CA5359 // Do Not Disable Certificate Validation
}
await client.ConnectAsync(Server, Port.Value, MailKit.Security.SecureSocketOptions.Auto, connectCancel.Token);
- if ((client.Capabilities & SmtpCapabilities.Authentication) != 0
+ if (client.Capabilities.Contains(SmtpCapability.Authentication)
&& !string.IsNullOrWhiteSpace(Login)
&& !string.IsNullOrWhiteSpace(Password))
await client.AuthenticateAsync(Login, Password, connectCancel.Token);
### BTCPayServer/Services/Wallets/Export/TransactionsExport.cs
@@ -5,8 +5,6 @@
using System.IO;
using System.Linq;
using BTCPayServer.Data;
-using CsvHelper.Configuration;
-using CsvHelper.Configuration.Attributes;
using Newtonsoft.Json;
namespace BTCPayServer.Services.Wallets.Export
@@ -89,34 +87,48 @@ private static string ProcessJson(List<ExportTransaction> invoices)
private static string ProcessCsv(IEnumerable<ExportTransaction> invoices)
{
using StringWriter writer = new();
- using var csvWriter = new CsvHelper.CsvWriter(writer, new CsvConfiguration(CultureInfo.InvariantCulture), true);
- csvWriter.Context.RegisterClassMap<ExportTransactionMap>();
- csvWriter.WriteHeader<ExportTransaction>();
- csvWriter.NextRecord();
- csvWriter.WriteRecords(invoices);
+ using var csvWriter = CsvHelper.CsvWriter.Create(writer, new CsvHelper.CsvWriterOptions
+ {
+ FormatProvider = CultureInfo.InvariantCulture,
+ NewLine = "\r\n"
+ }, leaveOpen: true);
+ csvWriter.WriteHeader("Transaction Id", "Timestamp", "Amount", "Currency", "Is Confirmed", "Comment", "Labels");
+ foreach (var invoice in invoices)
+ {
+ csvWriter.WriteField(invoice.TransactionId);
+ csvWriter.WriteField(invoice.Timestamp.ToString(CultureInfo.InvariantCulture));
+ csvWriter.WriteField(invoice.Amount);
+ csvWriter.WriteField(invoice.Currency);
+ csvWriter.WriteField(invoice.IsConfirmed.ToString());
+ csvWriter.WriteField(EscapeCsvMetadata(invoice.Comment));
+ csvWriter.WriteField(EscapeCsvMetadata(invoice.Labels == null ? string.Empty : string.Join(", ", invoice.Labels)));
+ csvWriter.EndRecord();
+ }
csvWriter.Flush();
return writer.ToString();
}
- }
- public sealed class ExportTransactionMap : ClassMap<ExportTransaction>
- {
- public ExportTransactionMap()
+ private static string? EscapeCsvMetadata(string? value)
{
- AutoMap(CultureInfo.InvariantCulture);
- Map(m => m.Labels).Convert(row => row.Value.Labels == null ? string.Empty : string.Join(", ", row.Value.Labels));
+ if (string.IsNullOrEmpty(value))
+ return value;
+
+ // Quoting CSV fields alone does not stop spreadsheets from evaluating formulas.
+ var trimmed = value.AsSpan().TrimStart();
+ return value[0] is '\t' or '\r' or '\n' ||
+ (!trimmed.IsEmpty && trimmed[0] is '=' or '+' or '-' or '@' or '=' or '+' or '-' or '@')
+ ? "'" + value
+ : value;
}
}
public class ExportTransaction
{
- [Name("Transaction Id")]
public string TransactionId { get; set; } = string.Empty;
public DateTimeOffset Timestamp { get; set; }
public string Amount { get; set; } = string.Empty;
public string Currency { get; set; } = string.Empty;
- [Name("Is Confirmed")]
public bool IsConfirmed { get; set; }
public string? Comment { get; set; }
public List<string>? Labels { get; set; }Why this scored 34/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.