Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Upgrade all projects to .NET 9 (#360)
Leendert de Borst201af7b88a5a
diff --git a/src/AliasVault.Admin/AliasVault.Admin.csproj b/src/AliasVault.Admin/AliasVault.Admin.csprojindex f4514e7bc..72bd686ee 100644--- a/src/AliasVault.Admin/AliasVault.Admin.csproj+++ b/src/AliasVault.Admin/AliasVault.Admin.csproj@@ -1,12 +1,13 @@<Project Sdk="Microsoft.NET.Sdk.Web"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><Nullable>enable</Nullable><ImplicitUsings>enable</ImplicitUsings><UserSecretsId>aspnet-AliasVault.Admin-1DAADE35-C01B-43BB-B440-AA5E1E0B672D</UserSecretsId><DockerDefaultTargetOS>Linux</DockerDefaultTargetOS><NoWarn>1701;1702;NU1900</NoWarn>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">@@ -20,8 +21,8 @@</PropertyGroup><ItemGroup>- <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.10" />- <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.10">+ <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="9.0.0" />+ <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets></PackageReference>diff --git a/src/AliasVault.Api/AliasVault.Api.csproj b/src/AliasVault.Api/AliasVault.Api.csprojindex 40d56cd04..77597b4bf 100644--- a/src/AliasVault.Api/AliasVault.Api.csproj+++ b/src/AliasVault.Api/AliasVault.Api.csproj@@ -1,13 +1,14 @@<Project Sdk="Microsoft.NET.Sdk.Web"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><Nullable>enable</Nullable><ImplicitUsings>enable</ImplicitUsings><RootNamespace>AliasVault.Api</RootNamespace><DockerDefaultTargetOS>Linux</DockerDefaultTargetOS><GenerateDocumentationFile>True</GenerateDocumentationFile><DefineConstants Condition="'$(E2ETEST)' == 'true'">$(DefineConstants);E2ETEST</DefineConstants>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">@@ -21,14 +22,14 @@<ItemGroup><PackageReference Include="Asp.Versioning.Mvc" Version="8.1.0" /><PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />- <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.10" />+ <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0" /><PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.2.0" /><PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.2.0" /><PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets></PackageReference>- <PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />+ <PackageReference Include="Swashbuckle.AspNetCore" Version="7.0.0" /></ItemGroup><ItemGroup>diff --git a/src/AliasVault.Client/AliasVault.Client.csproj b/src/AliasVault.Client/AliasVault.Client.csprojindex 5ed66e265..89ea72d17 100644--- a/src/AliasVault.Client/AliasVault.Client.csproj+++ b/src/AliasVault.Client/AliasVault.Client.csproj@@ -1,12 +1,13 @@<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"><PropertyGroup><RootNamespace>AliasVault.Client</RootNamespace>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><Nullable>enable</Nullable><ImplicitUsings>enable</ImplicitUsings><DockerDefaultTargetOS>Linux</DockerDefaultTargetOS><BuildVersion>$([System.DateTime]::UtcNow.ToString("yyyy-MM-dd HH:mm:ss"))</BuildVersion><WasmBuildNative>true</WasmBuildNative>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition="'$(Configuration)' == 'Debug'">@@ -48,15 +49,16 @@<ItemGroup><PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />- <PackageReference Include="Microsoft.AspNetCore.Authorization" Version="8.0.10" />- <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.10" />- <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.10" />- <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.10" PrivateAssets="all" />- <PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />+ <PackageReference Include="Microsoft.AspNetCore.Authorization" Version="9.0.0" />+ <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" />+ <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="9.0.0" />+ <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" PrivateAssets="all" />+ <PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" /><PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets></PackageReference>+ <PackageReference Include="System.Private.Uri" Version="4.3.2" /></ItemGroup><ItemGroup>diff --git a/src/AliasVault.Client/Main/Components/Loading/SmallLoadingIndicator.razor b/src/AliasVault.Client/Main/Components/Loading/SmallLoadingIndicator.razorindex e996b1b98..a81d64f77 100644--- a/src/AliasVault.Client/Main/Components/Loading/SmallLoadingIndicator.razor+++ b/src/AliasVault.Client/Main/Components/Loading/SmallLoadingIndicator.razor@@ -11,12 +11,21 @@</div>@code {+ /// <summary>+ /// Title tag text of the loading indicator.+ /// </summary>[Parameter]public string Title { get; set; } = string.Empty;+ /// <summary>+ /// Whether the loading indicator is spinning.+ /// </summary>[Parameter]public bool Spinning { get; set; } = true;+ /// <summary>+ /// The content to display inside the loading indicator.+ /// </summary>[Parameter]public RenderFragment? ChildContent { get; set; }}diff --git a/src/Databases/AliasClientDb/AliasClientDb.csproj b/src/Databases/AliasClientDb/AliasClientDb.csprojindex 9358f4d11..a3cc87379 100644--- a/src/Databases/AliasClientDb/AliasClientDb.csproj+++ b/src/Databases/AliasClientDb/AliasClientDb.csproj@@ -1,9 +1,10 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">@@ -17,16 +18,16 @@</PropertyGroup><ItemGroup>- <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />- <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">+ <PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />+ <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets></PackageReference>- <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.10" />- <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.10" />- <PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />- <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.1" />- <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />+ <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="9.0.0" />+ <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />+ <PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />+ <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.0" />+ <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" /><PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>diff --git a/src/Databases/AliasServerDb/AliasServerDb.csproj b/src/Databases/AliasServerDb/AliasServerDb.csprojindex 73fc70076..2c14c33cd 100644--- a/src/Databases/AliasServerDb/AliasServerDb.csproj+++ b/src/Databases/AliasServerDb/AliasServerDb.csproj@@ -1,10 +1,11 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><GenerateDocumentationFile>True</GenerateDocumentationFile>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">@@ -16,20 +17,20 @@</PropertyGroup><ItemGroup>- <PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="8.0.10" />- <PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="8.0.10" />- <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.10" />- <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />- <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">+ <PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="9.0.0" />+ <PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="9.0.0" />+ <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.0" />+ <PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />+ <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets></PackageReference>- <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.10" />- <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.10" />- <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />- <PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />- <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.1" />- <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />+ <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="9.0.0" />+ <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />+ <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />+ <PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />+ <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.0" />+ <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" /><PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>diff --git a/src/Generators/AliasVault.Generators.Identity/AliasVault.Generators.Identity.csproj b/src/Generators/AliasVault.Generators.Identity/AliasVault.Generators.Identity.csprojindex af4e19203..862293c40 100644--- a/src/Generators/AliasVault.Generators.Identity/AliasVault.Generators.Identity.csproj+++ b/src/Generators/AliasVault.Generators.Identity/AliasVault.Generators.Identity.csproj@@ -1,9 +1,10 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">diff --git a/src/Generators/AliasVault.Generators.Password/AliasVault.Generators.Password.csproj b/src/Generators/AliasVault.Generators.Password/AliasVault.Generators.Password.csprojindex 1a913d111..86019becc 100644--- a/src/Generators/AliasVault.Generators.Password/AliasVault.Generators.Password.csproj+++ b/src/Generators/AliasVault.Generators.Password/AliasVault.Generators.Password.csproj@@ -1,9 +1,10 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">diff --git a/src/Services/AliasVault.SmtpService/AliasVault.SmtpService.csproj b/src/Services/AliasVault.SmtpService/AliasVault.SmtpService.csprojindex f325d76fb..7db2abc79 100644--- a/src/Services/AliasVault.SmtpService/AliasVault.SmtpService.csproj+++ b/src/Services/AliasVault.SmtpService/AliasVault.SmtpService.csproj@@ -1,12 +1,13 @@<Project Sdk="Microsoft.NET.Sdk.Worker"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><Nullable>enable</Nullable><ImplicitUsings>enable</ImplicitUsings><UserSecretsId>dotnet-AliasVault.SmtpService-eaac287e-32a7-4ff9-bbf9-1925c446ef73</UserSecretsId><DockerDefaultTargetOS>Linux</DockerDefaultTargetOS><DockerfileContext>..\..\..</DockerfileContext>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">@@ -24,7 +25,7 @@</ItemGroup><ItemGroup>- <PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />+ <PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" /><PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" /><PackageReference Include="MimeKit" Version="4.8.0" /><PackageReference Include="NUglify" Version="1.21.10" />diff --git a/src/Services/AliasVault.SmtpService/Program.cs b/src/Services/AliasVault.SmtpService/Program.csindex 0659c9519..f4b9f532d 100644--- a/src/Services/AliasVault.SmtpService/Program.cs+++ b/src/Services/AliasVault.SmtpService/Program.cs@@ -97,9 +97,8 @@ builder.Services.AddSingleton(// If we don't do this, the certificate will be loaded without the private key and// will throw error on Windows:// "The TLS server credential's certificate does not have a private key information property attached to it"- cert = new X509Certificate2(cert.Export(X509ContentType.Pfx));-- return cert;+ var certBytes = cert.Export(X509ContentType.Pfx, "password");+ return X509CertificateLoader.LoadPkcs12(certBytes, "password", X509KeyStorageFlags.EphemeralKeySet);}});diff --git a/src/Shared/AliasVault.RazorComponents/AliasVault.RazorComponents.csproj b/src/Shared/AliasVault.RazorComponents/AliasVault.RazorComponents.csprojindex 7173ff8df..d44f2214f 100644--- a/src/Shared/AliasVault.RazorComponents/AliasVault.RazorComponents.csproj+++ b/src/Shared/AliasVault.RazorComponents/AliasVault.RazorComponents.csproj@@ -1,9 +1,10 @@<Project Sdk="Microsoft.NET.Sdk.Razor"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><Nullable>enable</Nullable><ImplicitUsings>enable</ImplicitUsings>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">@@ -22,7 +23,7 @@</ItemGroup><ItemGroup>- <PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.10" />+ <PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0" /><PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>diff --git a/src/Shared/AliasVault.RazorComponents/ConfirmModal.razor b/src/Shared/AliasVault.RazorComponents/ConfirmModal.razorindex 7b545f928..f6f9e7db3 100644--- a/src/Shared/AliasVault.RazorComponents/ConfirmModal.razor+++ b/src/Shared/AliasVault.RazorComponents/ConfirmModal.razor@@ -27,11 +27,13 @@}@code {+ /// <inheritdoc/>protected override void OnInitialized(){ModalService.OnChange += StateHasChanged;}+ /// <inheritdoc/>public void Dispose(){ModalService.OnChange -= StateHasChanged;diff --git a/src/Shared/AliasVault.Shared.Core/AliasVault.Shared.Core.csproj b/src/Shared/AliasVault.Shared.Core/AliasVault.Shared.Core.csprojindex 8f620d10b..5df750825 100644--- a/src/Shared/AliasVault.Shared.Core/AliasVault.Shared.Core.csproj+++ b/src/Shared/AliasVault.Shared.Core/AliasVault.Shared.Core.csproj@@ -1,9 +1,10 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">diff --git a/src/Shared/AliasVault.Shared/AliasVault.Shared.csproj b/src/Shared/AliasVault.Shared/AliasVault.Shared.csprojindex b8e18aa0d..a74ac1915 100644--- a/src/Shared/AliasVault.Shared/AliasVault.Shared.csproj+++ b/src/Shared/AliasVault.Shared/AliasVault.Shared.csproj@@ -1,9 +1,10 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">@@ -21,7 +22,7 @@</ItemGroup><ItemGroup>- <PackageReference Include="HtmlAgilityPack" Version="1.11.70" />+ <PackageReference Include="HtmlAgilityPack" Version="1.11.71" /><PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>diff --git a/src/Tests/AliasVault.E2ETests/AliasVault.E2ETests.csproj b/src/Tests/AliasVault.E2ETests/AliasVault.E2ETests.csprojindex 1f070c26d..8cc1cbaea 100644--- a/src/Tests/AliasVault.E2ETests/AliasVault.E2ETests.csproj+++ b/src/Tests/AliasVault.E2ETests/AliasVault.E2ETests.csproj@@ -1,11 +1,12 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><IsPackable>false</IsPackable><IsTestProject>true</IsTestProject>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">@@ -27,7 +28,7 @@</ItemGroup><ItemGroup>- <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.10" />+ <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.0" /><PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" /><PackageReference Include="NUnit" Version="4.2.2" /><PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />diff --git a/src/Tests/AliasVault.IntegrationTests/AliasVault.IntegrationTests.csproj b/src/Tests/AliasVault.IntegrationTests/AliasVault.IntegrationTests.csprojindex 021fbe605..2e575856f 100644--- a/src/Tests/AliasVault.IntegrationTests/AliasVault.IntegrationTests.csproj+++ b/src/Tests/AliasVault.IntegrationTests/AliasVault.IntegrationTests.csproj@@ -1,12 +1,12 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>-<IsPackable>false</IsPackable><IsTestProject>true</IsTestProject>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">diff --git a/src/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csproj b/src/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csprojindex 8e9becc11..9d9492416 100644--- a/src/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csproj+++ b/src/Tests/AliasVault.UnitTests/AliasVault.UnitTests.csproj@@ -1,13 +1,13 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>-<IsPackable>false</IsPackable><IsTestProject>true</IsTestProject><RootNamespace>AliasVault.Tests</RootNamespace>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">diff --git a/src/Tests/AliasVault.UnitTests/Utilities/ConversionUtilityTest.cs b/src/Tests/AliasVault.UnitTests/Utilities/ConversionUtilityTest.csindex d962ca456..06141dd35 100644--- a/src/Tests/AliasVault.UnitTests/Utilities/ConversionUtilityTest.cs+++ b/src/Tests/AliasVault.UnitTests/Utilities/ConversionUtilityTest.cs@@ -90,7 +90,7 @@ public partial class ConversionUtilityTeststring anchorHtml = "<a href=\"test.html\" target=\"_blank\">test anchor text</a>";string convertedAnchorTags = ConversionUtility.ConvertAnchorTagsToOpenInNewTab(anchorHtml);- int targetBlankCount = TargetBlankRegex().Matches(convertedAnchorTags).Count;+ int targetBlankCount = Regex.Matches(convertedAnchorTags, "target=\"_blank\"", RegexOptions.NonBacktracking).Count;Assert.Multiple(() =>{@@ -104,11 +104,4 @@ public partial class ConversionUtilityTestAssert.That(convertedAnchorTags, Does.Contain(">test anchor text</a>"), "The anchor text should be preserved.");});}-- /// <summary>- /// Regex to match an anchor tag with an href attribute, generated at compile time.- /// </summary>- /// <returns></returns>- [GeneratedRegex("target=\"_blank\"")]- private static partial Regex TargetBlankRegex();}diff --git a/src/Tests/AliasVault.UnitTests/Utilities/SrpArgonEncryptionTests.cs b/src/Tests/AliasVault.UnitTests/Utilities/SrpArgonEncryptionTests.csindex 9c28b913d..46e44b881 100644--- a/src/Tests/AliasVault.UnitTests/Utilities/SrpArgonEncryptionTests.cs+++ b/src/Tests/AliasVault.UnitTests/Utilities/SrpArgonEncryptionTests.cs@@ -8,7 +8,6 @@namespace AliasVault.Tests.Utilities;using AliasVault.Cryptography.Client;-using Org.BouncyCastle.Crypto;using SecureRemotePassword;/// <summary>@@ -90,7 +89,7 @@ public class SrpArgonEncryptionTests// SymmetricDecrypt the ciphertext using a different keybyte[] key2 = await Cryptography.Client.Encryption.DeriveKeyFromPasswordAsync("your-password2", salt);- Assert.Throws<InvalidCipherTextException>(() => Cryptography.Server.Encryption.SymmetricDecrypt(encrypted, key2));+ Assert.Throws<Exception>(() => Cryptography.Server.Encryption.SymmetricDecrypt(encrypted, key2));}/// <summary>diff --git a/src/Tests/Server/AliasVault.E2ETests.Client.Server/AliasVault.E2ETests.Client.Server.csproj b/src/Tests/Server/AliasVault.E2ETests.Client.Server/AliasVault.E2ETests.Client.Server.csprojindex 239982807..9e4addc80 100644--- a/src/Tests/Server/AliasVault.E2ETests.Client.Server/AliasVault.E2ETests.Client.Server.csproj+++ b/src/Tests/Server/AliasVault.E2ETests.Client.Server/AliasVault.E2ETests.Client.Server.csproj@@ -1,13 +1,14 @@<Project Sdk="Microsoft.NET.Sdk.Web"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><Nullable>enable</Nullable><ImplicitUsings>enable</ImplicitUsings>+ <LangVersion>13</LangVersion></PropertyGroup><ItemGroup>- <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.10" />+ <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.0" /></ItemGroup><ItemGroup>diff --git a/src/Utilities/AliasVault.Auth/AliasVault.Auth.csproj b/src/Utilities/AliasVault.Auth/AliasVault.Auth.csprojindex b522a22b4..85e8d0d88 100644--- a/src/Utilities/AliasVault.Auth/AliasVault.Auth.csproj+++ b/src/Utilities/AliasVault.Auth/AliasVault.Auth.csproj@@ -1,9 +1,10 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">diff --git a/src/Utilities/AliasVault.CsvImportExport/AliasVault.CsvImportExport.csproj b/src/Utilities/AliasVault.CsvImportExport/AliasVault.CsvImportExport.csprojindex 1795c021b..890d226ec 100644--- a/src/Utilities/AliasVault.CsvImportExport/AliasVault.CsvImportExport.csproj+++ b/src/Utilities/AliasVault.CsvImportExport/AliasVault.CsvImportExport.csproj@@ -1,9 +1,10 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>+ <LangVersion>13</LangVersion></PropertyGroup><ItemGroup>diff --git a/src/Utilities/AliasVault.FaviconExtractor/AliasVault.FaviconExtractor.csproj b/src/Utilities/AliasVault.FaviconExtractor/AliasVault.FaviconExtractor.csprojindex 48753f417..18a376e7e 100644--- a/src/Utilities/AliasVault.FaviconExtractor/AliasVault.FaviconExtractor.csproj+++ b/src/Utilities/AliasVault.FaviconExtractor/AliasVault.FaviconExtractor.csproj@@ -1,9 +1,10 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">@@ -21,7 +22,7 @@</ItemGroup><ItemGroup>- <PackageReference Include="HtmlAgilityPack" Version="1.11.70" />+ <PackageReference Include="HtmlAgilityPack" Version="1.11.71" /><PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>diff --git a/src/Utilities/AliasVault.InstallCli/AliasVault.InstallCli.csproj b/src/Utilities/AliasVault.InstallCli/AliasVault.InstallCli.csprojindex 009d3ac39..8d53992c6 100644--- a/src/Utilities/AliasVault.InstallCli/AliasVault.InstallCli.csproj+++ b/src/Utilities/AliasVault.InstallCli/AliasVault.InstallCli.csproj@@ -2,9 +2,10 @@<PropertyGroup><OutputType>Exe</OutputType>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">diff --git a/src/Utilities/AliasVault.Logging/AliasVault.Logging.csproj b/src/Utilities/AliasVault.Logging/AliasVault.Logging.csprojindex 5fd3ac034..4cef529e1 100644--- a/src/Utilities/AliasVault.Logging/AliasVault.Logging.csproj+++ b/src/Utilities/AliasVault.Logging/AliasVault.Logging.csproj@@ -1,9 +1,10 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">@@ -17,10 +18,10 @@</PropertyGroup><ItemGroup>- <PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />- <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />- <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />- <PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />+ <PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />+ <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0" />+ <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />+ <PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" /><PackageReference Include="Newtonsoft.Json" Version="13.0.3" /><PackageReference Include="Serilog" Version="4.1.0" /><PackageReference Include="Serilog.Extensions.Hosting" Version="8.0.0" />diff --git a/src/Utilities/AliasVault.TotpGenerator/AliasVault.TotpGenerator.csproj b/src/Utilities/AliasVault.TotpGenerator/AliasVault.TotpGenerator.csprojindex ecc045c64..df47ccbc6 100644--- a/src/Utilities/AliasVault.TotpGenerator/AliasVault.TotpGenerator.csproj+++ b/src/Utilities/AliasVault.TotpGenerator/AliasVault.TotpGenerator.csproj@@ -1,9 +1,10 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">diff --git a/src/Utilities/AliasVault.WorkerStatus/AliasVault.WorkerStatus.csproj b/src/Utilities/AliasVault.WorkerStatus/AliasVault.WorkerStatus.csprojindex b2abff037..083f9ef0d 100644--- a/src/Utilities/AliasVault.WorkerStatus/AliasVault.WorkerStatus.csproj+++ b/src/Utilities/AliasVault.WorkerStatus/AliasVault.WorkerStatus.csproj@@ -1,9 +1,10 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">@@ -21,8 +22,8 @@</ItemGroup><ItemGroup>- <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />- <PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />+ <PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />+ <PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" /><PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>diff --git a/src/Utilities/Cryptography/AliasVault.Cryptography.Client/AliasVault.Cryptography.Client.csproj b/src/Utilities/Cryptography/AliasVault.Cryptography.Client/AliasVault.Cryptography.Client.csprojindex a03387865..a17044313 100644--- a/src/Utilities/Cryptography/AliasVault.Cryptography.Client/AliasVault.Cryptography.Client.csproj+++ b/src/Utilities/Cryptography/AliasVault.Cryptography.Client/AliasVault.Cryptography.Client.csproj@@ -1,9 +1,10 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">diff --git a/src/Utilities/Cryptography/AliasVault.Cryptography.Server/AliasVault.Cryptography.Server.csproj b/src/Utilities/Cryptography/AliasVault.Cryptography.Server/AliasVault.Cryptography.Server.csprojindex d8b847017..4ef9d7ba7 100644--- a/src/Utilities/Cryptography/AliasVault.Cryptography.Server/AliasVault.Cryptography.Server.csproj+++ b/src/Utilities/Cryptography/AliasVault.Cryptography.Server/AliasVault.Cryptography.Server.csproj@@ -1,9 +1,10 @@<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup>- <TargetFramework>net8.0</TargetFramework>+ <TargetFramework>net9.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>+ <LangVersion>13</LangVersion></PropertyGroup><PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">@@ -21,7 +22,6 @@</ItemGroup><ItemGroup>- <PackageReference Include="BouncyCastle.NetCore" Version="2.2.1" /><PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556"><PrivateAssets>all</PrivateAssets><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>diff --git a/src/Utilities/Cryptography/AliasVault.Cryptography.Server/CertificateGenerator.cs b/src/Utilities/Cryptography/AliasVault.Cryptography.Server/CertificateGenerator.csindex 824b3d231..7c9f3404d 100644--- a/src/Utilities/Cryptography/AliasVault.Cryptography.Server/CertificateGenerator.cs+++ b/src/Utilities/Cryptography/AliasVault.Cryptography.Server/CertificateGenerator.cs@@ -47,10 +47,8 @@ public static class CertificateGeneratorDateTimeOffset.UtcNow.AddDays(-1),DateTimeOffset.UtcNow.AddYears(validityYears));- return new X509Certificate2(- certificate.Export(X509ContentType.Pfx, password),- password,- X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable);+ var certBytes = certificate.Export(X509ContentType.Pfx, password);+ return X509CertificateLoader.LoadPkcs12(certBytes, password, X509KeyStorageFlags.EphemeralKeySet);}}diff --git a/src/Utilities/Cryptography/AliasVault.Cryptography.Server/DataProtectionExtensions.cs b/src/Utilities/Cryptography/AliasVault.Cryptography.Server/DataProtectionExtensions.csindex 691292896..2284de7a7 100644--- a/src/Utilities/Cryptography/AliasVault.Cryptography.Server/DataProtectionExtensions.cs+++ b/src/Utilities/Cryptography/AliasVault.Cryptography.Server/DataProtectionExtensions.cs@@ -10,7 +10,6 @@ namespace AliasVault.Cryptography.Server;using System.Security.Cryptography.X509Certificates;using AliasServerDb;using Microsoft.AspNetCore.DataProtection;-using Microsoft.Extensions.Configuration;using Microsoft.Extensions.DependencyInjection;/// <summary>@@ -29,10 +28,9 @@ public static class DataProtectionExtensionsthis IServiceCollection services,string applicationName){- string certPassword = Environment.GetEnvironmentVariable("DATA_PROTECTION_CERT_PASS")+ var certPassword = Environment.GetEnvironmentVariable("DATA_PROTECTION_CERT_PASS")?? throw new KeyNotFoundException("DATA_PROTECTION_CERT_PASS is not set in configuration or environment variables.");-- string certPath = "../../certificates/AliasVault.DataProtection.pfx";+ var certPath = "../../certificates/AliasVault.DataProtection.pfx";if (certPassword == "Development"){certPath = Path.Combine(AppContext.BaseDirectory, "AliasVault.DataProtection.Development.pfx");@@ -46,7 +44,7 @@ public static class DataProtectionExtensions}else{- cert = new X509Certificate2(certPath, certPassword);+ cert = X509Certificate2.CreateFromPemFile(certPath, certPath);}services.AddDataProtection()diff --git a/src/Utilities/Cryptography/AliasVault.Cryptography.Server/Encryption.cs b/src/Utilities/Cryptography/AliasVault.Cryptography.Server/Encryption.csindex d3ca7946f..76a0a89c7 100644--- a/src/Utilities/Cryptography/AliasVault.Cryptography.Server/Encryption.cs+++ b/src/Utilities/Cryptography/AliasVault.Cryptography.Server/Encryption.cs@@ -10,10 +10,6 @@ namespace AliasVault.Cryptography.Server;using System.Security.Cryptography;using System.Text;using System.Text.Json;-using Org.BouncyCastle.Crypto.Engines;-using Org.BouncyCastle.Crypto.Modes;-using Org.BouncyCastle.Crypto.Parameters;-using Org.BouncyCastle.Security;/// <summary>/// RSA/AES and Argon2id encryption methods.@@ -86,23 +82,22 @@ public static class Encryption/// <returns>The encrypted string (ciphertext).</returns>public static byte[] SymmetricEncrypt(byte[] plainBytes, byte[] key){- byte[] iv = new byte[12];- SecureRandom random = new();- random.NextBytes(iv);+ byte[] nonce = new byte[AesGcm.NonceByteSizes.MaxSize]; // 12 bytes+ RandomNumberGenerator.Fill(nonce);- GcmBlockCipher gcm = new(new AesEngine());- AeadParameters parameters = new(new KeyParameter(key), 128, iv, null);- gcm.Init(true, parameters);+ byte[] ciphertext = new byte[plainBytes.Length];+ byte[] tag = new byte[AesGcm.TagByteSizes.MaxSize]; // 16 bytes- byte[] ciphertextBytes = new byte[gcm.GetOutputSize(plainBytes.Length)];- int outputLength = gcm.ProcessBytes(plainBytes, 0, plainBytes.Length, ciphertextBytes, 0);- gcm.DoFinal(ciphertextBytes, outputLength);+ using var aesGcm = new AesGcm(key, AesGcm.TagByteSizes.MaxSize);+ aesGcm.Encrypt(nonce, plainBytes, ciphertext, tag);- byte[] combined = new byte[iv.Length + ciphertextBytes.Length];- Array.Copy(iv, 0, combined, 0, iv.Length);- Array.Copy(ciphertextBytes, 0, combined, iv.Length, ciphertextBytes.Length);+ // Combine nonce + ciphertext + tag+ byte[] result = new byte[nonce.Length + ciphertext.Length + tag.Length];+ Buffer.BlockCopy(nonce, 0, result, 0, nonce.Length);+ Buffer.BlockCopy(ciphertext, 0, result, nonce.Length, ciphertext.Length);+ Buffer.BlockCopy(tag, 0, result, nonce.Length + ciphertext.Length, tag.Length);- return combined;+ return result;}/// <summary>@@ -125,21 +120,23 @@ public static class Encryption/// <returns>The original plaintext string.</returns>public static byte[] SymmetricDecrypt(byte[] encryptedBytes, byte[] key){- byte[] iv = new byte[12];- byte[] cipherBytes = new byte[encryptedBytes.Length - iv.Length];+ int nonceSize = AesGcm.NonceByteSizes.MaxSize;+ int tagSize = AesGcm.TagByteSizes.MaxSize;- Array.Copy(encryptedBytes, 0, iv, 0, iv.Length);- Array.Copy(encryptedBytes, iv.Length, cipherBytes, 0, cipherBytes.Length);+ // Extract nonce, ciphertext, and tag+ byte[] nonce = new byte[nonceSize];+ byte[] tag = new byte[tagSize];+ byte[] ciphertext = new byte[encryptedBytes.Length - nonceSize - tagSize];- GcmBlockCipher gcm = new(new AesEngine());- AeadParameters parameters = new(new KeyParameter(key), 128, iv, null);- gcm.Init(false, parameters);+ Buffer.BlockCopy(encryptedBytes, 0, nonce, 0, nonceSize);+ Buffer.BlockCopy(encryptedBytes, nonceSize, ciphertext, 0, ciphertext.Length);+ Buffer.BlockCopy(encryptedBytes, nonceSize + ciphertext.Length, tag, 0, tagSize);- byte[] plaintextBytes = new byte[gcm.GetOutputSize(cipherBytes.Length)];- int outputLength = gcm.ProcessBytes(cipherBytes, 0, cipherBytes.Length, plaintextBytes, 0);- gcm.DoFinal(plaintextBytes, outputLength);+ byte[] plaintext = new byte[ciphertext.Length];+ using var aesGcm = new AesGcm(key, tagSize);+ aesGcm.Decrypt(nonce, ciphertext, tag, plaintext);- return plaintextBytes;+ return plaintext;}/// <summary>