// ----------------------------------------------------------------------------- // Models.cs // Sprint: SPRINT_5100_0003_0001_sbom_interop_roundtrip // Task: T1, T7 - Interop Test Harness & Project Setup // Description: Models for SBOM interoperability testing. // ----------------------------------------------------------------------------- using System.Collections.Immutable; using System.Security.Cryptography; using System.Text; namespace StellaOps.Interop.Tests; public enum SbomFormat { CycloneDx16, Spdx30 } public sealed record SbomResult( bool Success, string? Path = null, SbomFormat? Format = null, string? Content = null, string? Digest = null, string? Error = null) { public static SbomResult Failed(string error) => new(false, Error: error); } public sealed record AttestationResult( bool Success, string? ImageRef = null, string? Error = null) { public static AttestationResult Failed(string error) => new(false, Error: error); } public sealed record GrypeScanResult( bool Success, IReadOnlyList? Findings = null, string? RawOutput = null, string? Error = null) { public static GrypeScanResult Failed(string error) => new(false, Error: error); } public sealed record GrypeFinding( string VulnerabilityId, string PackagePurl, string Severity, string? FixedIn = null); public sealed record Finding( string VulnerabilityId, string PackagePurl, string Severity); public sealed record ToolResult( bool Success, string Output, string? Error = null); public sealed record FindingsComparisonResult( decimal ParityPercent, bool IsWithinTolerance, int StellaTotalFindings, int GrypeTotalFindings, int MatchingFindings, int OnlyInStella, int OnlyInGrype, IReadOnlyList<(string VulnId, string Purl)> OnlyInStellaDetails, IReadOnlyList<(string VulnId, string Purl)> OnlyInGrypeDetails); public sealed record VerifyResult( bool Success, string? PredicateDigest = null, string? Error = null);