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
105 lines
2.9 KiB
C#
105 lines
2.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace StellaOps.Scanner.WebService.Contracts;
|
|
|
|
public sealed record ReportRequestDto
|
|
{
|
|
[JsonPropertyName("imageDigest")]
|
|
public string? ImageDigest { get; init; }
|
|
|
|
[JsonPropertyName("findings")]
|
|
public IReadOnlyList<PolicyPreviewFindingDto>? Findings { get; init; }
|
|
|
|
[JsonPropertyName("baseline")]
|
|
public IReadOnlyList<PolicyPreviewVerdictDto>? Baseline { get; init; }
|
|
}
|
|
|
|
public sealed record ReportResponseDto
|
|
{
|
|
[JsonPropertyName("report")]
|
|
public ReportDocumentDto Report { get; init; } = new();
|
|
|
|
[JsonPropertyName("dsse")]
|
|
public DsseEnvelopeDto? Dsse { get; init; }
|
|
}
|
|
|
|
public sealed record ReportDocumentDto
|
|
{
|
|
[JsonPropertyName("reportId")]
|
|
[JsonPropertyOrder(0)]
|
|
public string ReportId { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("imageDigest")]
|
|
[JsonPropertyOrder(1)]
|
|
public string ImageDigest { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("generatedAt")]
|
|
[JsonPropertyOrder(2)]
|
|
public DateTimeOffset GeneratedAt { get; init; }
|
|
|
|
[JsonPropertyName("verdict")]
|
|
[JsonPropertyOrder(3)]
|
|
public string Verdict { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("policy")]
|
|
[JsonPropertyOrder(4)]
|
|
public ReportPolicyDto Policy { get; init; } = new();
|
|
|
|
[JsonPropertyName("summary")]
|
|
[JsonPropertyOrder(5)]
|
|
public ReportSummaryDto Summary { get; init; } = new();
|
|
|
|
[JsonPropertyName("verdicts")]
|
|
[JsonPropertyOrder(6)]
|
|
public IReadOnlyList<PolicyPreviewVerdictDto> Verdicts { get; init; } = Array.Empty<PolicyPreviewVerdictDto>();
|
|
|
|
[JsonPropertyName("issues")]
|
|
[JsonPropertyOrder(7)]
|
|
public IReadOnlyList<PolicyPreviewIssueDto> Issues { get; init; } = Array.Empty<PolicyPreviewIssueDto>();
|
|
|
|
[JsonPropertyName("surface")]
|
|
[JsonPropertyOrder(8)]
|
|
public SurfacePointersDto? Surface { get; init; }
|
|
|
|
[JsonPropertyName("linksets")]
|
|
[JsonPropertyOrder(9)]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
public IReadOnlyList<LinksetSummaryDto>? Linksets { get; init; }
|
|
}
|
|
|
|
public sealed record ReportPolicyDto
|
|
{
|
|
[JsonPropertyName("revisionId")]
|
|
[JsonPropertyOrder(0)]
|
|
public string? RevisionId { get; init; }
|
|
|
|
[JsonPropertyName("digest")]
|
|
[JsonPropertyOrder(1)]
|
|
public string? Digest { get; init; }
|
|
}
|
|
|
|
public sealed record ReportSummaryDto
|
|
{
|
|
[JsonPropertyName("total")]
|
|
[JsonPropertyOrder(0)]
|
|
public int Total { get; init; }
|
|
|
|
[JsonPropertyName("blocked")]
|
|
[JsonPropertyOrder(1)]
|
|
public int Blocked { get; init; }
|
|
|
|
[JsonPropertyName("warned")]
|
|
[JsonPropertyOrder(2)]
|
|
public int Warned { get; init; }
|
|
|
|
[JsonPropertyName("ignored")]
|
|
[JsonPropertyOrder(3)]
|
|
public int Ignored { get; init; }
|
|
|
|
[JsonPropertyName("quieted")]
|
|
[JsonPropertyOrder(4)]
|
|
public int Quieted { get; init; }
|
|
}
|