stabilize tests
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Collections.Immutable;
|
||||
using System.Globalization;
|
||||
using System.Security.Cryptography;
|
||||
@@ -5,9 +9,6 @@ using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace StellaOps.BinaryIndex.GoldenSet;
|
||||
|
||||
/// <summary>
|
||||
@@ -142,12 +143,12 @@ public sealed partial class GoldenSetValidator : IGoldenSetValidator
|
||||
return; // Already reported as missing
|
||||
}
|
||||
|
||||
// Accept CVE-YYYY-NNNN or GHSA-xxxx-xxxx-xxxx formats
|
||||
if (!CveIdRegex().IsMatch(id) && !GhsaIdRegex().IsMatch(id))
|
||||
// Accept CVE-YYYY-NNNN, GHSA-xxxx-xxxx-xxxx, or SYNTH-NNNN-xxx formats
|
||||
if (!CveIdRegex().IsMatch(id) && !GhsaIdRegex().IsMatch(id) && !SyntheticIdRegex().IsMatch(id))
|
||||
{
|
||||
errors.Add(new ValidationError(
|
||||
ValidationErrorCodes.InvalidIdFormat,
|
||||
string.Format(CultureInfo.InvariantCulture, "Invalid ID format: {0}. Expected CVE-YYYY-NNNN or GHSA-xxxx-xxxx-xxxx.", id),
|
||||
string.Format(CultureInfo.InvariantCulture, "Invalid ID format: {0}. Expected CVE-YYYY-NNNN, GHSA-xxxx-xxxx-xxxx, or SYNTH-NNNN-name.", id),
|
||||
"id"));
|
||||
}
|
||||
}
|
||||
@@ -401,6 +402,9 @@ public sealed partial class GoldenSetValidator : IGoldenSetValidator
|
||||
[GeneratedRegex(GoldenSetConstants.GhsaIdPattern)]
|
||||
private static partial Regex GhsaIdRegex();
|
||||
|
||||
[GeneratedRegex(GoldenSetConstants.SyntheticIdPattern)]
|
||||
private static partial Regex SyntheticIdRegex();
|
||||
|
||||
[GeneratedRegex(@"^\d+\.\d+\.\d+$")]
|
||||
private static partial Regex SchemaVersionRegex();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user