196 lines
5.1 KiB
C#
196 lines
5.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace StellaOps.Scanner.WebService.Contracts;
|
|
|
|
public sealed record PolicyPreviewRequestDto
|
|
{
|
|
[JsonPropertyName("imageDigest")]
|
|
public string? ImageDigest { get; init; }
|
|
|
|
[JsonPropertyName("findings")]
|
|
public IReadOnlyList<PolicyPreviewFindingDto>? Findings { get; init; }
|
|
|
|
[JsonPropertyName("baseline")]
|
|
public IReadOnlyList<PolicyPreviewVerdictDto>? Baseline { get; init; }
|
|
|
|
[JsonPropertyName("policy")]
|
|
public PolicyPreviewPolicyDto? Policy { get; init; }
|
|
}
|
|
|
|
public sealed record PolicyPreviewFindingDto
|
|
{
|
|
[JsonPropertyName("id")]
|
|
public string? Id { get; init; }
|
|
|
|
[JsonPropertyName("severity")]
|
|
public string? Severity { get; init; }
|
|
|
|
[JsonPropertyName("environment")]
|
|
public string? Environment { get; init; }
|
|
|
|
[JsonPropertyName("source")]
|
|
public string? Source { get; init; }
|
|
|
|
[JsonPropertyName("vendor")]
|
|
public string? Vendor { get; init; }
|
|
|
|
[JsonPropertyName("license")]
|
|
public string? License { get; init; }
|
|
|
|
[JsonPropertyName("image")]
|
|
public string? Image { get; init; }
|
|
|
|
[JsonPropertyName("repository")]
|
|
public string? Repository { get; init; }
|
|
|
|
[JsonPropertyName("package")]
|
|
public string? Package { get; init; }
|
|
|
|
[JsonPropertyName("purl")]
|
|
public string? Purl { get; init; }
|
|
|
|
[JsonPropertyName("cve")]
|
|
public string? Cve { get; init; }
|
|
|
|
[JsonPropertyName("path")]
|
|
public string? Path { get; init; }
|
|
|
|
[JsonPropertyName("layerDigest")]
|
|
public string? LayerDigest { get; init; }
|
|
|
|
[JsonPropertyName("tags")]
|
|
public IReadOnlyList<string>? Tags { get; init; }
|
|
}
|
|
|
|
public sealed record PolicyPreviewVerdictDto
|
|
{
|
|
[JsonPropertyName("findingId")]
|
|
[JsonPropertyOrder(0)]
|
|
public string? FindingId { get; init; }
|
|
|
|
[JsonPropertyName("reachability")]
|
|
[JsonPropertyOrder(1)]
|
|
public string? Reachability { get; init; }
|
|
|
|
[JsonPropertyName("score")]
|
|
[JsonPropertyOrder(2)]
|
|
public double? Score { get; init; }
|
|
|
|
[JsonPropertyName("sourceTrust")]
|
|
[JsonPropertyOrder(3)]
|
|
public string? SourceTrust { get; init; }
|
|
|
|
[JsonPropertyName("status")]
|
|
[JsonPropertyOrder(4)]
|
|
public string? Status { get; init; }
|
|
|
|
[JsonPropertyName("ruleName")]
|
|
[JsonPropertyOrder(5)]
|
|
public string? RuleName { get; init; }
|
|
|
|
[JsonPropertyName("ruleAction")]
|
|
[JsonPropertyOrder(6)]
|
|
public string? RuleAction { get; init; }
|
|
|
|
[JsonPropertyName("notes")]
|
|
[JsonPropertyOrder(7)]
|
|
public string? Notes { get; init; }
|
|
|
|
[JsonPropertyName("configVersion")]
|
|
[JsonPropertyOrder(8)]
|
|
public string? ConfigVersion { get; init; }
|
|
|
|
[JsonPropertyName("inputs")]
|
|
[JsonPropertyOrder(9)]
|
|
public IReadOnlyDictionary<string, double>? Inputs { get; init; }
|
|
|
|
[JsonPropertyName("quietedBy")]
|
|
[JsonPropertyOrder(10)]
|
|
public string? QuietedBy { get; init; }
|
|
|
|
[JsonPropertyName("quiet")]
|
|
[JsonPropertyOrder(11)]
|
|
public bool? Quiet { get; init; }
|
|
|
|
[JsonPropertyName("unknownConfidence")]
|
|
[JsonPropertyOrder(12)]
|
|
public double? UnknownConfidence { get; init; }
|
|
|
|
[JsonPropertyName("confidenceBand")]
|
|
[JsonPropertyOrder(13)]
|
|
public string? ConfidenceBand { get; init; }
|
|
|
|
[JsonPropertyName("unknownAgeDays")]
|
|
[JsonPropertyOrder(14)]
|
|
public double? UnknownAgeDays { get; init; }
|
|
|
|
}
|
|
|
|
public sealed record PolicyPreviewPolicyDto
|
|
{
|
|
[JsonPropertyName("content")]
|
|
public string? Content { get; init; }
|
|
|
|
[JsonPropertyName("format")]
|
|
public string? Format { get; init; }
|
|
|
|
[JsonPropertyName("actor")]
|
|
public string? Actor { get; init; }
|
|
|
|
[JsonPropertyName("description")]
|
|
public string? Description { get; init; }
|
|
}
|
|
|
|
public sealed record PolicyPreviewResponseDto
|
|
{
|
|
[JsonPropertyName("success")]
|
|
public bool Success { get; init; }
|
|
|
|
[JsonPropertyName("policyDigest")]
|
|
public string? PolicyDigest { get; init; }
|
|
|
|
[JsonPropertyName("revisionId")]
|
|
public string? RevisionId { get; init; }
|
|
|
|
[JsonPropertyName("changed")]
|
|
public int Changed { get; init; }
|
|
|
|
[JsonPropertyName("diffs")]
|
|
public IReadOnlyList<PolicyPreviewDiffDto> Diffs { get; init; } = Array.Empty<PolicyPreviewDiffDto>();
|
|
|
|
[JsonPropertyName("issues")]
|
|
public IReadOnlyList<PolicyPreviewIssueDto> Issues { get; init; } = Array.Empty<PolicyPreviewIssueDto>();
|
|
}
|
|
|
|
public sealed record PolicyPreviewDiffDto
|
|
{
|
|
[JsonPropertyName("findingId")]
|
|
public string? FindingId { get; init; }
|
|
|
|
[JsonPropertyName("baseline")]
|
|
public PolicyPreviewVerdictDto? Baseline { get; init; }
|
|
|
|
[JsonPropertyName("projected")]
|
|
public PolicyPreviewVerdictDto? Projected { get; init; }
|
|
|
|
[JsonPropertyName("changed")]
|
|
public bool Changed { get; init; }
|
|
}
|
|
|
|
public sealed record PolicyPreviewIssueDto
|
|
{
|
|
[JsonPropertyName("code")]
|
|
public string Code { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("message")]
|
|
public string Message { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("severity")]
|
|
public string Severity { get; init; } = string.Empty;
|
|
|
|
[JsonPropertyName("path")]
|
|
public string Path { get; init; } = string.Empty;
|
|
}
|