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,44 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using StellaOps.Scanner.Core.Contracts;
|
||||
using StellaOps.Scanner.Core.Utility;
|
||||
|
||||
namespace StellaOps.Scanner.Emit.Composition;
|
||||
|
||||
public sealed record ImageArtifactDescriptor
|
||||
{
|
||||
public string ImageDigest { get; init; } = string.Empty;
|
||||
|
||||
public string? ImageReference { get; init; }
|
||||
= null;
|
||||
|
||||
public string? Repository { get; init; }
|
||||
= null;
|
||||
|
||||
public string? Tag { get; init; }
|
||||
= null;
|
||||
|
||||
public string? Architecture { get; init; }
|
||||
= null;
|
||||
}
|
||||
|
||||
public sealed record SbomCompositionRequest
|
||||
{
|
||||
public required ImageArtifactDescriptor Image { get; init; }
|
||||
|
||||
public required ImmutableArray<LayerComponentFragment> LayerFragments { get; init; }
|
||||
|
||||
public DateTimeOffset GeneratedAt { get; init; }
|
||||
= ScannerTimestamps.UtcNow();
|
||||
|
||||
public string? GeneratorName { get; init; }
|
||||
= null;
|
||||
|
||||
public string? GeneratorVersion { get; init; }
|
||||
= null;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using StellaOps.Scanner.Core.Contracts;
|
||||
using StellaOps.Scanner.Core.Utility;
|
||||
|
||||
namespace StellaOps.Scanner.Emit.Composition;
|
||||
|
||||
public sealed record ImageArtifactDescriptor
|
||||
{
|
||||
public string ImageDigest { get; init; } = string.Empty;
|
||||
|
||||
public string? ImageReference { get; init; }
|
||||
= null;
|
||||
|
||||
public string? Repository { get; init; }
|
||||
= null;
|
||||
|
||||
public string? Tag { get; init; }
|
||||
= null;
|
||||
|
||||
public string? Architecture { get; init; }
|
||||
= null;
|
||||
}
|
||||
|
||||
public sealed record SbomCompositionRequest
|
||||
{
|
||||
public required ImageArtifactDescriptor Image { get; init; }
|
||||
|
||||
public required ImmutableArray<LayerComponentFragment> LayerFragments { get; init; }
|
||||
|
||||
public DateTimeOffset GeneratedAt { get; init; }
|
||||
= ScannerTimestamps.UtcNow();
|
||||
|
||||
public string? GeneratorName { get; init; }
|
||||
= null;
|
||||
|
||||
public string? GeneratorVersion { get; init; }
|
||||
= null;
|
||||
|
||||
public IReadOnlyDictionary<string, string>? AdditionalProperties { get; init; }
|
||||
= null;
|
||||
|
||||
@@ -58,17 +58,17 @@ public sealed record SbomCompositionRequest
|
||||
ArgumentNullException.ThrowIfNull(fragments);
|
||||
|
||||
var normalizedImage = new ImageArtifactDescriptor
|
||||
{
|
||||
ImageDigest = ScannerIdentifiers.NormalizeDigest(image.ImageDigest) ?? throw new ArgumentException("Image digest is required.", nameof(image)),
|
||||
ImageReference = Normalize(image.ImageReference),
|
||||
Repository = Normalize(image.Repository),
|
||||
Tag = Normalize(image.Tag),
|
||||
Architecture = Normalize(image.Architecture),
|
||||
};
|
||||
|
||||
return new SbomCompositionRequest
|
||||
{
|
||||
Image = normalizedImage,
|
||||
{
|
||||
ImageDigest = ScannerIdentifiers.NormalizeDigest(image.ImageDigest) ?? throw new ArgumentException("Image digest is required.", nameof(image)),
|
||||
ImageReference = Normalize(image.ImageReference),
|
||||
Repository = Normalize(image.Repository),
|
||||
Tag = Normalize(image.Tag),
|
||||
Architecture = Normalize(image.Architecture),
|
||||
};
|
||||
|
||||
return new SbomCompositionRequest
|
||||
{
|
||||
Image = normalizedImage,
|
||||
LayerFragments = fragments.ToImmutableArray(),
|
||||
GeneratedAt = ScannerTimestamps.Normalize(generatedAt),
|
||||
GeneratorName = Normalize(generatorName),
|
||||
@@ -80,10 +80,10 @@ public sealed record SbomCompositionRequest
|
||||
|
||||
private static string? Normalize(string? value)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return value.Trim();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user