up
Some checks failed
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
Manifest Integrity / Validate Schema Integrity (push) Has been cancelled
Manifest Integrity / Validate Contract Documents (push) Has been cancelled
Manifest Integrity / Validate Pack Fixtures (push) Has been cancelled
Manifest Integrity / Audit SHA256SUMS Files (push) Has been cancelled
Manifest Integrity / Verify Merkle Roots (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled

This commit is contained in:
StellaOps Bot
2025-12-12 09:35:37 +02:00
parent ce5ec9c158
commit efaf3cb789
238 changed files with 146274 additions and 5767 deletions

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using MongoDB.Bson.Serialization.Attributes;
namespace StellaOps.Signals.Models;
@@ -13,52 +12,37 @@ public sealed class ProvenanceFeed
{
public const int CurrentSchemaVersion = 1;
[BsonElement("schemaVersion")]
[JsonPropertyName("schemaVersion")]
public int SchemaVersion { get; init; } = CurrentSchemaVersion;
[BsonElement("feedId")]
[JsonPropertyName("feedId")]
public string FeedId { get; init; } = Guid.NewGuid().ToString("D");
[BsonElement("feedType")]
[JsonPropertyName("feedType")]
public ProvenanceFeedType FeedType { get; init; } = ProvenanceFeedType.RuntimeFacts;
[BsonElement("generatedAt")]
[JsonPropertyName("generatedAt")]
public DateTimeOffset GeneratedAt { get; init; } = DateTimeOffset.UtcNow;
[BsonElement("sourceService")]
[BsonIgnoreIfNull]
[JsonPropertyName("sourceService")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? SourceService { get; init; }
[BsonElement("tenantId")]
[BsonIgnoreIfNull]
[JsonPropertyName("tenantId")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? TenantId { get; init; }
[BsonElement("correlationId")]
[BsonIgnoreIfNull]
[JsonPropertyName("correlationId")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? CorrelationId { get; init; }
[BsonElement("records")]
[JsonPropertyName("records")]
public List<ProvenanceRecord> Records { get; init; } = new();
[BsonElement("metadata")]
[BsonIgnoreIfNull]
[JsonPropertyName("metadata")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Dictionary<string, string?>? Metadata { get; init; }
[BsonElement("attestation")]
[BsonIgnoreIfNull]
[JsonPropertyName("attestation")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public FeedAttestation? Attestation { get; init; }
@@ -88,42 +72,30 @@ public enum ProvenanceFeedType
/// </summary>
public sealed class ProvenanceRecord
{
[BsonElement("recordId")]
[JsonPropertyName("recordId")]
public string RecordId { get; init; } = Guid.NewGuid().ToString("D");
[BsonElement("recordType")]
[JsonPropertyName("recordType")]
public string RecordType { get; init; } = string.Empty;
[BsonElement("subject")]
[JsonPropertyName("subject")]
public ProvenanceSubject Subject { get; init; } = new();
[BsonElement("occurredAt")]
[JsonPropertyName("occurredAt")]
public DateTimeOffset OccurredAt { get; init; }
[BsonElement("observedBy")]
[BsonIgnoreIfNull]
[JsonPropertyName("observedBy")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ObservedBy { get; init; }
[BsonElement("confidence")]
[BsonIgnoreIfNull]
[JsonPropertyName("confidence")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public double? Confidence { get; init; }
[BsonElement("facts")]
[BsonIgnoreIfNull]
[JsonPropertyName("facts")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public RuntimeProvenanceFacts? Facts { get; init; }
[BsonElement("evidence")]
[BsonIgnoreIfNull]
[JsonPropertyName("evidence")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public RecordEvidence? Evidence { get; init; }
@@ -134,22 +106,16 @@ public sealed class ProvenanceRecord
/// </summary>
public sealed class ProvenanceSubject
{
[BsonElement("type")]
[JsonPropertyName("type")]
public ProvenanceSubjectType Type { get; init; } = ProvenanceSubjectType.Package;
[BsonElement("identifier")]
[JsonPropertyName("identifier")]
public string Identifier { get; init; } = string.Empty;
[BsonElement("digest")]
[BsonIgnoreIfNull]
[JsonPropertyName("digest")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Digest { get; init; }
[BsonElement("namespace")]
[BsonIgnoreIfNull]
[JsonPropertyName("namespace")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Namespace { get; init; }
@@ -182,66 +148,45 @@ public enum ProvenanceSubjectType
/// </summary>
public sealed class RuntimeProvenanceFacts
{
[BsonElement("symbolId")]
[BsonIgnoreIfNull]
[JsonPropertyName("symbolId")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? SymbolId { get; init; }
[BsonElement("processName")]
[BsonIgnoreIfNull]
[JsonPropertyName("processName")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ProcessName { get; init; }
[BsonElement("processId")]
[BsonIgnoreIfNull]
[JsonPropertyName("processId")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? ProcessId { get; init; }
[BsonElement("socketAddress")]
[BsonIgnoreIfNull]
[JsonPropertyName("socketAddress")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? SocketAddress { get; init; }
[BsonElement("containerId")]
[BsonIgnoreIfNull]
[JsonPropertyName("containerId")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ContainerId { get; init; }
[BsonElement("hitCount")]
[JsonPropertyName("hitCount")]
public int HitCount { get; init; }
[BsonElement("purl")]
[BsonIgnoreIfNull]
[JsonPropertyName("purl")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Purl { get; init; }
[BsonElement("codeId")]
[BsonIgnoreIfNull]
[JsonPropertyName("codeId")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? CodeId { get; init; }
[BsonElement("buildId")]
[BsonIgnoreIfNull]
[JsonPropertyName("buildId")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? BuildId { get; init; }
[BsonElement("loaderBase")]
[BsonIgnoreIfNull]
[JsonPropertyName("loaderBase")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? LoaderBase { get; init; }
[BsonElement("metadata")]
[BsonIgnoreIfNull]
[JsonPropertyName("metadata")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Dictionary<string, string?>? Metadata { get; init; }
@@ -252,20 +197,14 @@ public sealed class RuntimeProvenanceFacts
/// </summary>
public sealed class RecordEvidence
{
[BsonElement("sourceDigest")]
[BsonIgnoreIfNull]
[JsonPropertyName("sourceDigest")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? SourceDigest { get; init; }
[BsonElement("captureMethod")]
[BsonIgnoreIfNull]
[JsonPropertyName("captureMethod")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public EvidenceCaptureMethod? CaptureMethod { get; init; }
[BsonElement("rawDataRef")]
[BsonIgnoreIfNull]
[JsonPropertyName("rawDataRef")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? RawDataRef { get; init; }
@@ -295,28 +234,20 @@ public enum EvidenceCaptureMethod
/// </summary>
public sealed class FeedAttestation
{
[BsonElement("predicateType")]
[JsonPropertyName("predicateType")]
public string PredicateType { get; init; } = "https://stella.ops/attestation/provenance-feed/v1";
[BsonElement("signedAt")]
[JsonPropertyName("signedAt")]
public DateTimeOffset SignedAt { get; init; }
[BsonElement("keyId")]
[BsonIgnoreIfNull]
[JsonPropertyName("keyId")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? KeyId { get; init; }
[BsonElement("envelopeDigest")]
[BsonIgnoreIfNull]
[JsonPropertyName("envelopeDigest")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? EnvelopeDigest { get; init; }
[BsonElement("transparencyLog")]
[BsonIgnoreIfNull]
[JsonPropertyName("transparencyLog")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? TransparencyLog { get; init; }
@@ -327,17 +258,13 @@ public sealed class FeedAttestation
/// </summary>
public sealed class ContextFacts
{
[BsonElement("provenance")]
[BsonIgnoreIfNull]
[JsonPropertyName("provenance")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ProvenanceFeed? Provenance { get; set; }
[BsonElement("lastUpdatedAt")]
[JsonPropertyName("lastUpdatedAt")]
public DateTimeOffset LastUpdatedAt { get; set; }
[BsonElement("recordCount")]
[JsonPropertyName("recordCount")]
public int RecordCount { get; set; }
}

View File

@@ -1,33 +1,23 @@
using MongoDB.Bson.Serialization.Attributes;
namespace StellaOps.Signals.Models;
/// <summary>
/// Metadata describing the stored raw callgraph artifact.
/// </summary>
public sealed class CallgraphArtifactMetadata
{
[BsonElement("path")]
namespace StellaOps.Signals.Models;
/// <summary>
/// Metadata describing the stored raw callgraph artifact.
/// </summary>
public sealed class CallgraphArtifactMetadata
{
public string Path { get; set; } = string.Empty;
[BsonElement("hash")]
public string Hash { get; set; } = string.Empty;
[BsonElement("casUri")]
public string CasUri { get; set; } = string.Empty;
public string? CasUri { get; set; }
[BsonElement("manifestPath")]
public string ManifestPath { get; set; } = string.Empty;
[BsonElement("manifestCasUri")]
public string ManifestCasUri { get; set; } = string.Empty;
public string? ManifestCasUri { get; set; }
[BsonElement("graphHash")]
public string GraphHash { get; set; } = string.Empty;
[BsonElement("contentType")]
public string ContentType { get; set; } = string.Empty;
[BsonElement("length")]
public long Length { get; set; }
}
public long Length { get; set; }
}

View File

@@ -1,52 +1,34 @@
using System;
using System.Collections.Generic;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
namespace StellaOps.Signals.Models;
/// <summary>
/// MongoDB document representing an ingested callgraph.
/// </summary>
public sealed class CallgraphDocument
{
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public string Id { get; set; } = ObjectId.GenerateNewId().ToString();
[BsonElement("language")]
public string Language { get; set; } = string.Empty;
[BsonElement("component")]
public string Component { get; set; } = string.Empty;
[BsonElement("version")]
public string Version { get; set; } = string.Empty;
[BsonElement("ingestedAt")]
public DateTimeOffset IngestedAt { get; set; }
[BsonElement("artifact")]
public CallgraphArtifactMetadata Artifact { get; set; } = new();
[BsonElement("nodes")]
public List<CallgraphNode> Nodes { get; set; } = new();
[BsonElement("edges")]
using System;
using System.Collections.Generic;
namespace StellaOps.Signals.Models;
/// <summary>
/// Document representing an ingested callgraph.
/// </summary>
public sealed class CallgraphDocument
{
public string Id { get; set; } = Guid.NewGuid().ToString("N");
public string Language { get; set; } = string.Empty;
public string Component { get; set; } = string.Empty;
public string Version { get; set; } = string.Empty;
public DateTimeOffset IngestedAt { get; set; }
public CallgraphArtifactMetadata Artifact { get; set; } = new();
public List<CallgraphNode> Nodes { get; set; } = new();
public List<CallgraphEdge> Edges { get; set; } = new();
[BsonElement("metadata")]
[BsonIgnoreIfNull]
public Dictionary<string, string?>? Metadata { get; set; }
[BsonElement("graphHash")]
public string GraphHash { get; set; } = string.Empty;
[BsonElement("roots")]
[BsonIgnoreIfNull]
public List<CallgraphRoot>? Roots { get; set; }
[BsonElement("schemaVersion")]
[BsonIgnoreIfNull]
public string? SchemaVersion { get; set; }
}

View File

@@ -1,110 +1,71 @@
using System;
using System.Collections.Generic;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
namespace StellaOps.Signals.Models;
public sealed class ReachabilityFactDocument
{
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public string Id { get; set; } = ObjectId.GenerateNewId().ToString();
public string Id { get; set; } = Guid.NewGuid().ToString("N");
[BsonElement("callgraphId")]
public string CallgraphId { get; set; } = string.Empty;
[BsonElement("subject")]
public ReachabilitySubject Subject { get; set; } = new();
[BsonElement("entryPoints")]
public List<string> EntryPoints { get; set; } = new();
[BsonElement("states")]
public List<ReachabilityStateDocument> States { get; set; } = new();
[BsonElement("runtimeFacts")]
[BsonIgnoreIfNull]
public List<RuntimeFactDocument>? RuntimeFacts { get; set; }
[BsonElement("metadata")]
[BsonIgnoreIfNull]
public Dictionary<string, string?>? Metadata { get; set; }
[BsonElement("contextFacts")]
[BsonIgnoreIfNull]
public ContextFacts? ContextFacts { get; set; }
[BsonElement("score")]
public double Score { get; set; }
[BsonElement("unknownsCount")]
public int UnknownsCount { get; set; }
[BsonElement("unknownsPressure")]
public double UnknownsPressure { get; set; }
[BsonElement("computedAt")]
public DateTimeOffset ComputedAt { get; set; }
[BsonElement("subjectKey")]
[BsonRequired]
public string SubjectKey { get; set; } = string.Empty;
}
public sealed class ReachabilityStateDocument
{
[BsonElement("target")]
public string Target { get; set; } = string.Empty;
[BsonElement("reachable")]
public bool Reachable { get; set; }
[BsonElement("confidence")]
public double Confidence { get; set; }
[BsonElement("bucket")]
public string Bucket { get; set; } = "unknown";
[BsonElement("weight")]
public double Weight { get; set; }
[BsonElement("score")]
public double Score { get; set; }
[BsonElement("path")]
public List<string> Path { get; set; } = new();
[BsonElement("evidence")]
public ReachabilityEvidenceDocument Evidence { get; set; } = new();
}
public sealed class ReachabilityEvidenceDocument
{
[BsonElement("runtimeHits")]
public List<string> RuntimeHits { get; set; } = new();
[BsonElement("blockedEdges")]
[BsonIgnoreIfNull]
public List<string>? BlockedEdges { get; set; }
}
public sealed class ReachabilitySubject
{
[BsonElement("imageDigest")]
[BsonIgnoreIfNull]
public string? ImageDigest { get; set; }
[BsonElement("component")]
[BsonIgnoreIfNull]
public string? Component { get; set; }
[BsonElement("version")]
[BsonIgnoreIfNull]
public string? Version { get; set; }
[BsonElement("scanId")]
[BsonIgnoreIfNull]
public string? ScanId { get; set; }
public string ToSubjectKey()
@@ -125,57 +86,31 @@ public sealed class ReachabilitySubject
public sealed class RuntimeFactDocument
{
[BsonElement("symbolId")]
public string SymbolId { get; set; } = string.Empty;
[BsonElement("codeId")]
[BsonIgnoreIfNull]
public string? CodeId { get; set; }
[BsonElement("symbolDigest")]
[BsonIgnoreIfNull]
public string? SymbolDigest { get; set; }
[BsonElement("purl")]
[BsonIgnoreIfNull]
public string? Purl { get; set; }
[BsonElement("buildId")]
[BsonIgnoreIfNull]
public string? BuildId { get; set; }
[BsonElement("loaderBase")]
[BsonIgnoreIfNull]
public string? LoaderBase { get; set; }
[BsonElement("processId")]
[BsonIgnoreIfNull]
public int? ProcessId { get; set; }
[BsonElement("processName")]
[BsonIgnoreIfNull]
public string? ProcessName { get; set; }
[BsonElement("socketAddress")]
[BsonIgnoreIfNull]
public string? SocketAddress { get; set; }
[BsonElement("containerId")]
[BsonIgnoreIfNull]
public string? ContainerId { get; set; }
[BsonElement("evidenceUri")]
[BsonIgnoreIfNull]
public string? EvidenceUri { get; set; }
[BsonElement("hitCount")]
public int HitCount { get; set; }
[BsonElement("observedAt")]
[BsonIgnoreIfNull]
public DateTimeOffset? ObservedAt { get; set; }
[BsonElement("metadata")]
[BsonIgnoreIfNull]
public Dictionary<string, string?>? Metadata { get; set; }
}

View File

@@ -0,0 +1,29 @@
using System.Collections.Generic;
namespace StellaOps.Signals.Models;
/// <summary>
/// Request to generate synthetic runtime facts for a callgraph to unblock probe testing.
/// </summary>
public sealed class SyntheticRuntimeProbeRequest
{
/// <summary>
/// Target callgraph id to sample nodes from.
/// </summary>
public string CallgraphId { get; set; } = string.Empty;
/// <summary>
/// Subject to associate with generated runtime facts.
/// </summary>
public ReachabilitySubject? Subject { get; set; }
/// <summary>
/// Optional metadata attached to the runtime fact ingestion.
/// </summary>
public Dictionary<string, string?>? Metadata { get; set; }
/// <summary>
/// How many events to emit (defaults to 5, capped by node count).
/// </summary>
public int EventCount { get; set; } = 5;
}

View File

@@ -1,47 +1,26 @@
using System;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
namespace StellaOps.Signals.Models;
public sealed class UnknownSymbolDocument
{
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public string Id { get; set; } = ObjectId.GenerateNewId().ToString();
public string Id { get; set; } = Guid.NewGuid().ToString("N");
[BsonElement("subjectKey")]
[BsonRequired]
public string SubjectKey { get; set; } = string.Empty;
[BsonElement("callgraphId")]
[BsonIgnoreIfNull]
public string? CallgraphId { get; set; }
[BsonElement("symbolId")]
[BsonIgnoreIfNull]
public string? SymbolId { get; set; }
[BsonElement("codeId")]
[BsonIgnoreIfNull]
public string? CodeId { get; set; }
[BsonElement("purl")]
[BsonIgnoreIfNull]
public string? Purl { get; set; }
[BsonElement("edgeFrom")]
[BsonIgnoreIfNull]
public string? EdgeFrom { get; set; }
[BsonElement("edgeTo")]
[BsonIgnoreIfNull]
public string? EdgeTo { get; set; }
[BsonElement("reason")]
[BsonIgnoreIfNull]
public string? Reason { get; set; }
[BsonElement("createdAt")]
public DateTimeOffset CreatedAt { get; set; }
}