up
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Notify Smoke Test / Notify Unit Tests (push) Has been cancelled
Notify Smoke Test / Notifier Service Tests (push) Has been cancelled
Notify Smoke Test / Notification Smoke Test (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Signals Reachability Scoring & Events / reachability-smoke (push) Has been cancelled
Signals Reachability Scoring & Events / sign-and-upload (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Notify Smoke Test / Notify Unit Tests (push) Has been cancelled
Notify Smoke Test / Notifier Service Tests (push) Has been cancelled
Notify Smoke Test / Notification Smoke Test (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Signals Reachability Scoring & Events / reachability-smoke (push) Has been cancelled
Signals Reachability Scoring & Events / sign-and-upload (push) Has been cancelled
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace StellaOps.Concelier.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Canonical affected package descriptor with deterministic ordering of ranges and provenance.
|
||||
/// </summary>
|
||||
public sealed record AffectedPackage
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace StellaOps.Concelier.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Canonical affected package descriptor with deterministic ordering of ranges and provenance.
|
||||
/// </summary>
|
||||
public sealed record AffectedPackage
|
||||
{
|
||||
public static AffectedPackage Empty { get; } = new(
|
||||
AffectedPackageTypes.SemVer,
|
||||
identifier: "unknown",
|
||||
@@ -19,12 +19,12 @@ public sealed record AffectedPackage
|
||||
statuses: Array.Empty<AffectedPackageStatus>(),
|
||||
provenance: Array.Empty<AdvisoryProvenance>(),
|
||||
normalizedVersions: Array.Empty<NormalizedVersionRule>());
|
||||
|
||||
[JsonConstructor]
|
||||
public AffectedPackage(
|
||||
string type,
|
||||
string identifier,
|
||||
string? platform = null,
|
||||
|
||||
[JsonConstructor]
|
||||
public AffectedPackage(
|
||||
string type,
|
||||
string identifier,
|
||||
string? platform = null,
|
||||
IEnumerable<AffectedVersionRange>? versionRanges = null,
|
||||
IEnumerable<AffectedPackageStatus>? statuses = null,
|
||||
IEnumerable<AdvisoryProvenance>? provenance = null,
|
||||
@@ -34,17 +34,17 @@ public sealed record AffectedPackage
|
||||
Identifier = Validation.EnsureNotNullOrWhiteSpace(identifier, nameof(identifier));
|
||||
Platform = Validation.TrimToNull(platform);
|
||||
|
||||
VersionRanges = (versionRanges ?? Array.Empty<AffectedVersionRange>())
|
||||
.Distinct(AffectedVersionRangeEqualityComparer.Instance)
|
||||
.OrderBy(static range => range, AffectedVersionRangeComparer.Instance)
|
||||
.ToImmutableArray();
|
||||
|
||||
Statuses = (statuses ?? Array.Empty<AffectedPackageStatus>())
|
||||
.Where(static status => status is not null)
|
||||
.Distinct(AffectedPackageStatusEqualityComparer.Instance)
|
||||
.OrderBy(static status => status.Status, StringComparer.Ordinal)
|
||||
.ThenBy(static status => status.Provenance.Source, StringComparer.Ordinal)
|
||||
.ThenBy(static status => status.Provenance.Kind, StringComparer.Ordinal)
|
||||
VersionRanges = (versionRanges ?? Array.Empty<AffectedVersionRange>())
|
||||
.Distinct(AffectedVersionRangeEqualityComparer.Instance)
|
||||
.OrderBy(static range => range, AffectedVersionRangeComparer.Instance)
|
||||
.ToImmutableArray();
|
||||
|
||||
Statuses = (statuses ?? Array.Empty<AffectedPackageStatus>())
|
||||
.Where(static status => status is not null)
|
||||
.Distinct(AffectedPackageStatusEqualityComparer.Instance)
|
||||
.OrderBy(static status => status.Status, StringComparer.Ordinal)
|
||||
.ThenBy(static status => status.Provenance.Source, StringComparer.Ordinal)
|
||||
.ThenBy(static status => status.Provenance.Kind, StringComparer.Ordinal)
|
||||
.ThenBy(static status => status.Provenance.RecordedAt)
|
||||
.ToImmutableArray();
|
||||
|
||||
@@ -61,37 +61,37 @@ public sealed record AffectedPackage
|
||||
.ThenBy(static p => p.RecordedAt)
|
||||
.ToImmutableArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Semantic type of the coordinates (rpm, deb, cpe, semver, vendor, ics-vendor).
|
||||
/// </summary>
|
||||
public string Type { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Canonical identifier for the package (NEVRA, PackageURL, CPE string, vendor slug, etc.).
|
||||
/// </summary>
|
||||
public string Identifier { get; }
|
||||
|
||||
public string? Platform { get; }
|
||||
|
||||
public ImmutableArray<AffectedVersionRange> VersionRanges { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Semantic type of the coordinates (rpm, deb, cpe, semver, vendor, ics-vendor).
|
||||
/// </summary>
|
||||
public string Type { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Canonical identifier for the package (NEVRA, PackageURL, CPE string, vendor slug, etc.).
|
||||
/// </summary>
|
||||
public string Identifier { get; }
|
||||
|
||||
public string? Platform { get; }
|
||||
|
||||
public ImmutableArray<AffectedVersionRange> VersionRanges { get; }
|
||||
|
||||
public ImmutableArray<AffectedPackageStatus> Statuses { get; }
|
||||
|
||||
public ImmutableArray<NormalizedVersionRule> NormalizedVersions { get; }
|
||||
|
||||
public ImmutableArray<AdvisoryProvenance> Provenance { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Known values for <see cref="AffectedPackage.Type"/>.
|
||||
/// </summary>
|
||||
public static class AffectedPackageTypes
|
||||
{
|
||||
public const string Rpm = "rpm";
|
||||
public const string Deb = "deb";
|
||||
public const string Cpe = "cpe";
|
||||
public const string SemVer = "semver";
|
||||
public const string Vendor = "vendor";
|
||||
public const string IcsVendor = "ics-vendor";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Known values for <see cref="AffectedPackage.Type"/>.
|
||||
/// </summary>
|
||||
public static class AffectedPackageTypes
|
||||
{
|
||||
public const string Rpm = "rpm";
|
||||
public const string Deb = "deb";
|
||||
public const string Cpe = "cpe";
|
||||
public const string SemVer = "semver";
|
||||
public const string Vendor = "vendor";
|
||||
public const string IcsVendor = "ics-vendor";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user