129 lines
3.5 KiB
C#
129 lines
3.5 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace StellaOps.Scanner.Triage.Entities;
|
|
|
|
/// <summary>
|
|
/// Represents a scan that produced triage findings.
|
|
/// </summary>
|
|
[Table("triage_scan")]
|
|
public sealed class TriageScan
|
|
{
|
|
/// <summary>
|
|
/// Unique identifier for the scan.
|
|
/// </summary>
|
|
[Key]
|
|
[Column("id")]
|
|
public required Guid Id { get; init; }
|
|
|
|
/// <summary>
|
|
/// Tenant that owns this scan.
|
|
/// </summary>
|
|
[Required]
|
|
[Column("tenant_id")]
|
|
public required string TenantId { get; init; }
|
|
|
|
/// <summary>
|
|
/// Image reference that was scanned.
|
|
/// </summary>
|
|
[Required]
|
|
[Column("image_reference")]
|
|
public required string ImageReference { get; init; }
|
|
|
|
/// <summary>
|
|
/// Image digest (sha256:...).
|
|
/// </summary>
|
|
[Column("image_digest")]
|
|
public string? ImageDigest { get; init; }
|
|
|
|
/// <summary>
|
|
/// Target digest for replay command generation.
|
|
/// </summary>
|
|
[Column("target_digest")]
|
|
public string? TargetDigest { get; init; }
|
|
|
|
/// <summary>
|
|
/// Target reference for replay command generation.
|
|
/// </summary>
|
|
[Column("target_reference")]
|
|
public string? TargetReference { get; init; }
|
|
|
|
/// <summary>
|
|
/// Knowledge snapshot ID used for this scan.
|
|
/// </summary>
|
|
[Column("knowledge_snapshot_id")]
|
|
public string? KnowledgeSnapshotId { get; init; }
|
|
|
|
/// <summary>
|
|
/// When the scan started.
|
|
/// </summary>
|
|
[Column("started_at")]
|
|
public required DateTimeOffset StartedAt { get; init; }
|
|
|
|
/// <summary>
|
|
/// When the scan completed.
|
|
/// </summary>
|
|
[Column("completed_at")]
|
|
public DateTimeOffset? CompletedAt { get; set; }
|
|
|
|
/// <summary>
|
|
/// Scan status (running, completed, failed).
|
|
/// </summary>
|
|
[Required]
|
|
[Column("status")]
|
|
public required string Status { get; set; }
|
|
|
|
/// <summary>
|
|
/// Policy file hash used during the scan.
|
|
/// </summary>
|
|
[Column("policy_hash")]
|
|
public string? PolicyHash { get; init; }
|
|
|
|
/// <summary>
|
|
/// Feed snapshot hash for deterministic replay.
|
|
/// </summary>
|
|
[Column("feed_snapshot_hash")]
|
|
public string? FeedSnapshotHash { get; init; }
|
|
|
|
/// <summary>
|
|
/// When the knowledge snapshot was created.
|
|
/// </summary>
|
|
[Column("snapshot_created_at")]
|
|
public DateTimeOffset? SnapshotCreatedAt { get; init; }
|
|
|
|
/// <summary>
|
|
/// Feed versions used in this scan (JSON dictionary).
|
|
/// </summary>
|
|
[Column("feed_versions", TypeName = "jsonb")]
|
|
public Dictionary<string, string>? FeedVersions { get; init; }
|
|
|
|
/// <summary>
|
|
/// Content hash of the snapshot for verification.
|
|
/// </summary>
|
|
[Column("snapshot_content_hash")]
|
|
public string? SnapshotContentHash { get; init; }
|
|
|
|
/// <summary>
|
|
/// Final digest of the scan result for verification.
|
|
/// </summary>
|
|
[Column("final_digest")]
|
|
public string? FinalDigest { get; init; }
|
|
|
|
/// <summary>
|
|
/// Feed snapshot timestamp.
|
|
/// </summary>
|
|
[Column("feed_snapshot_at")]
|
|
public DateTimeOffset? FeedSnapshotAt { get; init; }
|
|
|
|
/// <summary>
|
|
/// Offline kit bundle ID if scan was done with offline kit.
|
|
/// </summary>
|
|
[Column("offline_bundle_id")]
|
|
public string? OfflineBundleId { get; init; }
|
|
|
|
/// <summary>
|
|
/// Navigation property to findings.
|
|
/// </summary>
|
|
public ICollection<TriageFinding> Findings { get; init; } = new List<TriageFinding>();
|
|
}
|