Fix build and code structure improvements. New but essential UI functionality. CI improvements. Documentation improvements. AI module improvements.
This commit is contained in:
@@ -114,8 +114,10 @@ public sealed class CryptographicFailuresTests : SecurityTestBase
|
||||
// Arrange
|
||||
var minVersion = GetMinimumTlsVersion();
|
||||
|
||||
// Assert
|
||||
minVersion.Should().BeGreaterOrEqualTo(System.Security.Authentication.SslProtocols.Tls12);
|
||||
// Assert - cast to int for numeric comparison since SslProtocols is a flags enum
|
||||
((int)minVersion).Should().BeGreaterThanOrEqualTo(
|
||||
(int)System.Security.Authentication.SslProtocols.Tls12,
|
||||
"Minimum TLS version should be at least TLS 1.2");
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "A02-006: Cryptographic random should be used for tokens")]
|
||||
@@ -146,7 +148,7 @@ public sealed class CryptographicFailuresTests : SecurityTestBase
|
||||
|
||||
// Assert
|
||||
derivedKey1.Should().BeEquivalentTo(derivedKey2, "Same inputs should produce same key");
|
||||
derivedKey1.Length.Should().BeGreaterOrEqualTo(32, "Derived keys should be at least 256 bits");
|
||||
derivedKey1.Length.Should().BeGreaterThanOrEqualTo(32, "Derived keys should be at least 256 bits");
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "A02-008: Certificate validation should be enabled")]
|
||||
@@ -210,9 +212,12 @@ public sealed class CryptographicFailuresTests : SecurityTestBase
|
||||
|
||||
private static byte[] DeriveKey(string password, byte[] salt, int iterations)
|
||||
{
|
||||
using var pbkdf2 = new System.Security.Cryptography.Rfc2898DeriveBytes(
|
||||
password, salt, iterations, System.Security.Cryptography.HashAlgorithmName.SHA256);
|
||||
return pbkdf2.GetBytes(32);
|
||||
return System.Security.Cryptography.Rfc2898DeriveBytes.Pbkdf2(
|
||||
password,
|
||||
salt,
|
||||
iterations,
|
||||
System.Security.Cryptography.HashAlgorithmName.SHA256,
|
||||
32);
|
||||
}
|
||||
|
||||
private static bool IsCertificateValidationEnabled()
|
||||
|
||||
@@ -85,8 +85,7 @@ public static partial class SecurityAssertions
|
||||
public static void AssertProperAuthorizationDenial(HttpStatusCode statusCode)
|
||||
{
|
||||
statusCode.Should().BeOneOf(
|
||||
HttpStatusCode.Unauthorized,
|
||||
HttpStatusCode.Forbidden,
|
||||
new[] { HttpStatusCode.Unauthorized, HttpStatusCode.Forbidden },
|
||||
"Response should properly deny unauthorized access");
|
||||
}
|
||||
|
||||
@@ -110,11 +109,11 @@ public static partial class SecurityAssertions
|
||||
|
||||
if (algorithm.Contains("RSA", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
keyBits.Should().BeGreaterOrEqualTo(2048, "RSA keys should be at least 2048 bits");
|
||||
keyBits.Should().BeGreaterThanOrEqualTo(2048, "RSA keys should be at least 2048 bits");
|
||||
}
|
||||
else if (algorithm.Contains("AES", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
keyBits.Should().BeGreaterOrEqualTo(128, "AES keys should be at least 128 bits");
|
||||
keyBits.Should().BeGreaterThanOrEqualTo(128, "AES keys should be at least 128 bits");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,23 +10,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="xunit" Version="2.9.3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Moq" Version="4.20.72" />
|
||||
<PackageReference Include="FluentAssertions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0" />
|
||||
</ItemGroup>
|
||||
<PackageReference Include="Moq" />
|
||||
<PackageReference Include="FluentAssertions" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- Add references to modules being tested as needed -->
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user