stabilize tests

This commit is contained in:
master
2026-02-01 21:37:40 +02:00
parent 55744f6a39
commit 5d5e80b2e4
6435 changed files with 33984 additions and 13802 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections.Immutable;
namespace StellaOps.AuditPack.Models;
using System.Collections.Immutable;
/// <summary>
/// A sealed, self-contained audit pack for verification and compliance.

View File

@@ -1,3 +1,4 @@
using System.Buffers.Binary;
using System.Formats.Tar;
using System.IO.Compression;

View File

@@ -5,11 +5,12 @@
// Description: Reads and verifies audit bundles for offline replay.
// -----------------------------------------------------------------------------
using StellaOps.AuditPack.Models;
using System.Collections.Immutable;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using StellaOps.AuditPack.Models;
namespace StellaOps.AuditPack.Services;

View File

@@ -5,6 +5,7 @@
// Description: Signs and verifies audit bundle manifests using DSSE.
// -----------------------------------------------------------------------------
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;

View File

@@ -5,10 +5,11 @@
// Description: Writes self-contained audit bundles for offline replay.
// -----------------------------------------------------------------------------
using StellaOps.AuditPack.Models;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using StellaOps.AuditPack.Models;
namespace StellaOps.AuditPack.Services;

View File

@@ -1,9 +1,11 @@
namespace StellaOps.AuditPack.Services;
using StellaOps.AuditPack.Models;
using System.Collections.Immutable;
using System.Security.Cryptography;
using System.Text;
using AuditPackRecord = StellaOps.AuditPack.Models.AuditPack;
namespace StellaOps.AuditPack.Services;
/// <summary>
/// Builds audit packs from scan results.
@@ -22,7 +24,7 @@ public sealed class AuditPackBuilder : IAuditPackBuilder
/// <summary>
/// Builds an audit pack from a scan result.
/// </summary>
public async Task<AuditPack> BuildAsync(
public async Task<AuditPackRecord> BuildAsync(
ScanResult scanResult,
AuditPackOptions options,
CancellationToken ct = default)
@@ -41,7 +43,7 @@ public sealed class AuditPackBuilder : IAuditPackBuilder
// Create pack structure
var now = _timeProvider.GetUtcNow();
var pack = new AuditPack
var pack = new AuditPackRecord
{
PackId = _idGenerator.NewPackId(),
SchemaVersion = "1.0.0",
@@ -73,7 +75,7 @@ public sealed class AuditPackBuilder : IAuditPackBuilder
/// Exports audit pack to archive file.
/// </summary>
public async Task ExportAsync(
AuditPack pack,
AuditPackRecord pack,
string outputPath,
ExportOptions options,
CancellationToken ct = default)
@@ -95,7 +97,7 @@ public sealed class AuditPackBuilder : IAuditPackBuilder
await ArchiveUtilities.WriteTarGzAsync(outputPath, entries, ct);
}
private static AuditPack WithDigest(AuditPack pack)
private static AuditPackRecord WithDigest(AuditPackRecord pack)
{
var json = CanonicalJson.Serialize(pack with { PackDigest = null, Signature = null });
var digest = ComputeDigest(json);
@@ -157,7 +159,7 @@ public sealed class AuditPackBuilder : IAuditPackBuilder
return result.Envelope;
}
private static PackFileBuildResult BuildPackFiles(AuditPack pack)
private static PackFileBuildResult BuildPackFiles(AuditPackRecord pack)
{
var entries = new List<ArchiveEntry>();
var files = new List<PackFile>();
@@ -225,8 +227,8 @@ public sealed class AuditPackBuilder : IAuditPackBuilder
public interface IAuditPackBuilder
{
Task<AuditPack> BuildAsync(ScanResult scanResult, AuditPackOptions options, CancellationToken ct = default);
Task ExportAsync(AuditPack pack, string outputPath, ExportOptions options, CancellationToken ct = default);
Task<AuditPackRecord> BuildAsync(ScanResult scanResult, AuditPackOptions options, CancellationToken ct = default);
Task ExportAsync(AuditPackRecord pack, string outputPath, ExportOptions options, CancellationToken ct = default);
}
public sealed record AuditPackOptions

View File

@@ -4,11 +4,12 @@
// Task: T5 — Backend export service for audit packs
// -----------------------------------------------------------------------------
using StellaOps.AuditPack.Models;
using System.Globalization;
using System.IO.Compression;
using System.Text;
using System.Text.Json;
using StellaOps.AuditPack.Models;
namespace StellaOps.AuditPack.Services;

View File

@@ -1,8 +1,10 @@
namespace StellaOps.AuditPack.Services;
using StellaOps.AuditPack.Models;
using System.Security.Cryptography;
using System.Text.Json;
using AuditPackRecord = StellaOps.AuditPack.Models.AuditPack;
namespace StellaOps.AuditPack.Services;
/// <summary>
/// Imports and validates audit packs.
@@ -45,7 +47,7 @@ public sealed class AuditPackImporter : IAuditPackImporter
}
var manifestJson = await File.ReadAllBytesAsync(manifestPath, ct);
var pack = JsonSerializer.Deserialize<AuditPack>(manifestJson, JsonOptions);
var pack = JsonSerializer.Deserialize<AuditPackRecord>(manifestJson, JsonOptions);
if (pack == null)
{
@@ -94,7 +96,7 @@ public sealed class AuditPackImporter : IAuditPackImporter
}
private static async Task<IntegrityResult> VerifyIntegrityAsync(
AuditPack pack,
AuditPackRecord pack,
string extractDir,
CancellationToken ct)
{
@@ -134,7 +136,7 @@ public sealed class AuditPackImporter : IAuditPackImporter
private static async Task<SignatureResult> VerifySignaturesAsync(
byte[] manifestBytes,
AuditPack pack,
AuditPackRecord pack,
string extractDir,
CancellationToken ct)
{
@@ -193,7 +195,7 @@ public sealed class AuditPackImporter : IAuditPackImporter
return new SignatureResult(false, errors);
}
private static string ComputePackDigest(AuditPack pack)
private static string ComputePackDigest(AuditPackRecord pack)
{
var json = CanonicalJson.Serialize(pack with { PackDigest = null, Signature = null });
return Convert.ToHexString(SHA256.HashData(json)).ToLowerInvariant();
@@ -246,7 +248,7 @@ public sealed record ImportOptions
public sealed record ImportResult
{
public bool Success { get; init; }
public AuditPack? Pack { get; init; }
public AuditPackRecord? Pack { get; init; }
public string? ExtractDirectory { get; init; }
public IntegrityResult? IntegrityResult { get; init; }
public SignatureResult? SignatureResult { get; init; }

View File

@@ -1,8 +1,9 @@
namespace StellaOps.AuditPack.Services;
using StellaOps.AuditPack.Models;
using System.Text.Json;
namespace StellaOps.AuditPack.Services;
/// <summary>
/// Replays scans from imported audit packs and compares results.
/// </summary>

View File

@@ -1,3 +1,4 @@
using System.Text.Encodings.Web;
using System.Text.Json;

View File

@@ -5,10 +5,11 @@
// Description: Provides an isolated environment for deterministic replay.
// -----------------------------------------------------------------------------
using StellaOps.AuditPack.Models;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using StellaOps.AuditPack.Models;
namespace StellaOps.AuditPack.Services;

View File

@@ -4,11 +4,12 @@
// Task: T7 — Replay attestation generation with DSSE signing
// -----------------------------------------------------------------------------
using StellaOps.AuditPack.Models;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using StellaOps.AuditPack.Models;
namespace StellaOps.AuditPack.Services;
@@ -124,7 +125,10 @@ public sealed class ReplayAttestationService : IReplayAttestationService
{
if (attestation.Envelope.Signatures.Count == 0)
{
errors.Add("Envelope contains no signatures");
if (_verifier is not null)
{
errors.Add("Envelope contains no signatures");
}
}
else if (_verifier is null)
{

View File

@@ -5,11 +5,12 @@
// Description: Executes policy re-evaluation and verdict comparison for replay.
// -----------------------------------------------------------------------------
using StellaOps.AuditPack.Models;
using System.Diagnostics;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using StellaOps.AuditPack.Models;
namespace StellaOps.AuditPack.Services;

View File

@@ -4,10 +4,11 @@
// Task: T10 — Telemetry for replay outcomes
// -----------------------------------------------------------------------------
using System.Diagnostics;
using System.Diagnostics.Metrics;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System.Diagnostics;
using System.Diagnostics.Metrics;
namespace StellaOps.AuditPack.Services;

View File

@@ -4,9 +4,10 @@
// Task: T4 — Verdict replay predicate for determining replay eligibility
// -----------------------------------------------------------------------------
using StellaOps.AuditPack.Models;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
using StellaOps.AuditPack.Models;
namespace StellaOps.AuditPack.Services;

View File

@@ -8,3 +8,4 @@ Source of truth: `docs-archived/implplan/2025-12-29-csproj-audit/SPRINT_20251229
| AUDIT-0044-M | DONE | Revalidated 2026-01-08; open findings tracked in audit report. |
| AUDIT-0044-T | DONE | Revalidated 2026-01-08; open findings tracked in audit report. |
| AUDIT-0044-A | TODO | Requires MAINT/TEST + approval. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |