Add global using for Xunit in test project Enhance ImportValidatorTests with async validation and quarantine checks Implement FileSystemQuarantineServiceTests for quarantine functionality Add integration tests for ImportValidator to check monotonicity Create BundleVersionTests to validate version parsing and comparison logic Implement VersionMonotonicityCheckerTests for monotonicity checks and activation logic
159 lines
4.7 KiB
C#
159 lines
4.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace StellaOps.Scanner.WebService.Contracts;
|
|
|
|
public sealed record ProofSpineListResponseDto
|
|
{
|
|
[JsonPropertyName("items")]
|
|
public IReadOnlyList<ProofSpineSummaryDto> Items { get; init; } = Array.Empty<ProofSpineSummaryDto>();
|
|
|
|
[JsonPropertyName("total")]
|
|
public int Total { get; init; }
|
|
}
|
|
|
|
public sealed record ProofSpineSummaryDto
|
|
{
|
|
[JsonPropertyName("spineId")]
|
|
public string SpineId { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("artifactId")]
|
|
public string ArtifactId { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("vulnerabilityId")]
|
|
public string VulnerabilityId { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("verdict")]
|
|
public string Verdict { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("segmentCount")]
|
|
public int SegmentCount { get; init; }
|
|
|
|
[JsonPropertyName("createdAt")]
|
|
public DateTimeOffset CreatedAt { get; init; }
|
|
}
|
|
|
|
public sealed record ProofSpineResponseDto
|
|
{
|
|
[JsonPropertyName("spineId")]
|
|
public string SpineId { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("artifactId")]
|
|
public string ArtifactId { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("vulnerabilityId")]
|
|
public string VulnerabilityId { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("policyProfileId")]
|
|
public string PolicyProfileId { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("verdict")]
|
|
public string Verdict { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("verdictReason")]
|
|
public string VerdictReason { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("rootHash")]
|
|
public string RootHash { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("scanRunId")]
|
|
public string ScanRunId { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("segments")]
|
|
public IReadOnlyList<ProofSegmentDto> Segments { get; init; } = Array.Empty<ProofSegmentDto>();
|
|
|
|
[JsonPropertyName("createdAt")]
|
|
public DateTimeOffset CreatedAt { get; init; }
|
|
|
|
[JsonPropertyName("supersededBySpineId")]
|
|
public string? SupersededBySpineId { get; init; }
|
|
|
|
[JsonPropertyName("verification")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public ProofSpineVerificationDto? Verification { get; init; }
|
|
}
|
|
|
|
public sealed record ProofSegmentDto
|
|
{
|
|
[JsonPropertyName("segmentId")]
|
|
public string SegmentId { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("segmentType")]
|
|
public string SegmentType { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("index")]
|
|
public int Index { get; init; }
|
|
|
|
[JsonPropertyName("inputHash")]
|
|
public string InputHash { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("resultHash")]
|
|
public string ResultHash { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("prevSegmentHash")]
|
|
public string? PrevSegmentHash { get; init; }
|
|
|
|
[JsonPropertyName("envelope")]
|
|
public DsseEnvelopeDto Envelope { get; init; } = new();
|
|
|
|
[JsonPropertyName("toolId")]
|
|
public string ToolId { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("toolVersion")]
|
|
public string ToolVersion { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("status")]
|
|
public string Status { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("createdAt")]
|
|
public DateTimeOffset CreatedAt { get; init; }
|
|
|
|
[JsonPropertyName("verificationErrors")]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public IReadOnlyList<string>? VerificationErrors { get; init; }
|
|
}
|
|
|
|
public sealed record DsseEnvelopeDto
|
|
{
|
|
[JsonPropertyName("payloadType")]
|
|
public string PayloadType { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("payload")]
|
|
public string Payload { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("signatures")]
|
|
public IReadOnlyList<DsseSignatureDto> Signatures { get; init; } = Array.Empty<DsseSignatureDto>();
|
|
}
|
|
|
|
public sealed record DsseSignatureDto
|
|
{
|
|
[JsonPropertyName("keyid")]
|
|
[JsonPropertyOrder(0)]
|
|
public string KeyId { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("sig")]
|
|
[JsonPropertyOrder(1)]
|
|
public string Sig { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("algorithm")]
|
|
[JsonPropertyOrder(2)]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public string? Algorithm { get; init; }
|
|
|
|
[JsonPropertyName("signature")]
|
|
[JsonPropertyOrder(3)]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public string? Signature { get; init; }
|
|
}
|
|
|
|
public sealed record ProofSpineVerificationDto
|
|
{
|
|
[JsonPropertyName("isValid")]
|
|
public bool IsValid { get; init; }
|
|
|
|
[JsonPropertyName("errors")]
|
|
public IReadOnlyList<string> Errors { get; init; } = Array.Empty<string>();
|
|
}
|
|
|