tests fixes

This commit is contained in:
master
2026-01-27 08:23:42 +02:00
parent c305d05d32
commit 82caceba56
58 changed files with 651 additions and 312 deletions

View File

@@ -165,7 +165,9 @@ public sealed class CryptographicFailuresTests : SecurityTestBase
{
var patterns = new[]
{
@"-----BEGIN[\s\S]*?-----END[A-Z\s]+-----",
@"-----BEGIN[\s\S]*?-----END[A-Z\s]+-----", // Full PEM blocks
@"-----BEGIN[A-Z\s]*PRIVATE\s*KEY-----", // PEM headers
@"PRIVATE\s+KEY", // "PRIVATE KEY" with space
@"private[_\-]?key[^\s]*",
@"PRIVATE[_\-]?KEY[^\s]*"
};

View File

@@ -196,15 +196,17 @@ public sealed class AuthenticationFailuresTests : SecurityTestBase
private static async Task<AuthResult> SimulateAuthAttempt(string username, string password)
{
await Task.Delay(1); // Simulate async operation
// Always increment attempt count for lockout tracking
IncrementAttemptCount(username);
// Simulate rate limiting after 5 attempts
var attempts = GetAttemptCount(username);
if (attempts >= 5)
{
return new AuthResult(false, true, "Authentication failed");
}
IncrementAttemptCount(username);
return new AuthResult(false, false, "Authentication failed");
}