docs consolidation and others

This commit is contained in:
master
2026-01-06 19:02:21 +02:00
parent d7bdca6d97
commit 4789027317
849 changed files with 16551 additions and 66770 deletions

View File

@@ -118,7 +118,7 @@ internal static class AirGapCommandGroup
return CommandHandlers.HandleAirGapExportAsync(
services,
output,
output!,
includeAdvisories,
includeVex,
includePolicies,

View File

@@ -594,7 +594,7 @@ internal static class BinaryCommandHandlers
Function = function,
FingerprintId = fingerprintId,
FingerprintHash = Convert.ToHexStringLower(fileHash),
GeneratedAt = DateTimeOffset.UtcNow.ToString("O")
GeneratedAt = (services.GetService<TimeProvider>() ?? TimeProvider.System).GetUtcNow().ToString("O")
};
if (format == "json")
@@ -662,7 +662,8 @@ internal static class BinaryCommandHandlers
}
// Resolve scan ID (auto-generate if not provided)
var effectiveScanId = scanId ?? $"cli-{Path.GetFileName(filePath)}-{DateTime.UtcNow:yyyyMMddHHmmss}";
var timeProvider = services.GetService<TimeProvider>() ?? TimeProvider.System;
var effectiveScanId = scanId ?? $"cli-{Path.GetFileName(filePath)}-{timeProvider.GetUtcNow():yyyyMMddHHmmss}";
CallGraphSnapshot snapshot = null!;

View File

@@ -10378,7 +10378,7 @@ internal static partial class CommandHandlers
.ToList();
var actualSigners = signatures.Select(s => s.KeyId).ToHashSet();
var missing = required.Where(r => !actualSigners.Contains(r)).ToList();
var missing = required.Where(r => !actualSigners.Contains(r!)).ToList();
if (missing.Count > 0)
{
@@ -11730,7 +11730,7 @@ internal static partial class CommandHandlers
}
// Check 3: Integrity verification (root hash)
var integrityOk = false;
_ = false; // integrityOk - tracked via checks list
if (index.TryGetProperty("integrity", out var integrity) &&
integrity.TryGetProperty("rootHash", out var rootHashElem))
{
@@ -11750,7 +11750,6 @@ internal static partial class CommandHandlers
if (computedRootHash == expectedRootHash.ToLowerInvariant())
{
checks.Add(("Root Hash Integrity", "PASS", $"Root hash matches: {expectedRootHash[..16]}..."));
integrityOk = true;
}
else
{
@@ -13656,7 +13655,6 @@ internal static partial class CommandHandlers
CancellationToken cancellationToken)
{
const int ExitSuccess = 0;
const int ExitInputError = 4;
var workspacePath = Path.GetFullPath(path ?? ".");
var policyName = name ?? Path.GetFileName(workspacePath);

View File

@@ -181,7 +181,7 @@ internal static class FeedsCommandGroup
return CommandHandlers.HandleFeedsSnapshotExportAsync(
services,
snapshotId,
snapshotId!,
output!,
compression,
json,
@@ -230,7 +230,7 @@ internal static class FeedsCommandGroup
return CommandHandlers.HandleFeedsSnapshotImportAsync(
services,
input,
input!,
validate,
json,
verbose,
@@ -270,7 +270,7 @@ internal static class FeedsCommandGroup
return CommandHandlers.HandleFeedsSnapshotValidateAsync(
services,
snapshotId,
snapshotId!,
json,
verbose,
cancellationToken);

View File

@@ -122,7 +122,7 @@ public class KeyRotationCommandGroup
var algorithm = parseResult.GetValue(algorithmOption) ?? "Ed25519";
var publicKeyPath = parseResult.GetValue(publicKeyOption);
var notes = parseResult.GetValue(notesOption);
Environment.ExitCode = await AddKeyAsync(anchorId, keyId, algorithm, publicKeyPath, notes, ct).ConfigureAwait(false);
Environment.ExitCode = await AddKeyAsync(anchorId, keyId!, algorithm, publicKeyPath, notes, ct).ConfigureAwait(false);
});
return addCommand;
@@ -171,7 +171,7 @@ public class KeyRotationCommandGroup
var reason = parseResult.GetValue(reasonOption) ?? "rotation-complete";
var effectiveAt = parseResult.GetValue(effectiveOption) ?? DateTimeOffset.UtcNow;
var force = parseResult.GetValue(forceOption);
Environment.ExitCode = await RevokeKeyAsync(anchorId, keyId, reason, effectiveAt, force, ct).ConfigureAwait(false);
Environment.ExitCode = await RevokeKeyAsync(anchorId, keyId!, reason, effectiveAt, force, ct).ConfigureAwait(false);
});
return revokeCommand;
@@ -227,7 +227,7 @@ public class KeyRotationCommandGroup
var algorithm = parseResult.GetValue(algorithmOption) ?? "Ed25519";
var publicKeyPath = parseResult.GetValue(publicKeyOption);
var overlapDays = parseResult.GetValue(overlapOption);
Environment.ExitCode = await RotateKeyAsync(anchorId, oldKeyId, newKeyId, algorithm, publicKeyPath, overlapDays, ct).ConfigureAwait(false);
Environment.ExitCode = await RotateKeyAsync(anchorId, oldKeyId!, newKeyId!, algorithm, publicKeyPath, overlapDays, ct).ConfigureAwait(false);
});
return rotateCommand;
@@ -332,7 +332,7 @@ public class KeyRotationCommandGroup
var anchorId = parseResult.GetValue(anchorArg);
var keyId = parseResult.GetValue(keyIdArg);
var signedAt = parseResult.GetValue(signedAtOption) ?? DateTimeOffset.UtcNow;
Environment.ExitCode = await VerifyKeyAsync(anchorId, keyId, signedAt, ct).ConfigureAwait(false);
Environment.ExitCode = await VerifyKeyAsync(anchorId, keyId!, signedAt, ct).ConfigureAwait(false);
});
return verifyCommand;

View File

@@ -153,7 +153,7 @@ internal static class WitnessCommandGroup
var tierOption = new Option<string?>("--tier")
{
Description = "Filter by confidence tier: confirmed, likely, present, unreachable."
}?.FromAmong("confirmed", "likely", "present", "unreachable");
}.FromAmong("confirmed", "likely", "present", "unreachable");
var reachableOnlyOption = new Option<bool>("--reachable-only")
{

View File

@@ -223,13 +223,14 @@ internal static class CliErrorRenderer
return false;
}
if ((!error.Metadata.TryGetValue("reason_code", out reasonCode) || string.IsNullOrWhiteSpace(reasonCode)) &&
(!error.Metadata.TryGetValue("reasonCode", out reasonCode) || string.IsNullOrWhiteSpace(reasonCode)))
string? tempCode;
if ((!error.Metadata.TryGetValue("reason_code", out tempCode) || string.IsNullOrWhiteSpace(tempCode)) &&
(!error.Metadata.TryGetValue("reasonCode", out tempCode) || string.IsNullOrWhiteSpace(tempCode)))
{
return false;
}
reasonCode = OfflineKitReasonCodes.Normalize(reasonCode) ?? "";
reasonCode = OfflineKitReasonCodes.Normalize(tempCode!) ?? "";
return reasonCode.Length > 0;
}

View File

@@ -328,8 +328,8 @@ public sealed class OutputRenderer : IOutputRenderer
for (var i = 0; i < columns.Count; i++)
{
widths[i] = columns[i].Header.Length;
if (columns[i].MinWidth.HasValue)
widths[i] = Math.Max(widths[i], columns[i].MinWidth.Value);
if (columns[i].MinWidth is { } minWidth)
widths[i] = Math.Max(widths[i], minWidth);
}
// Get all values and update widths
@@ -340,9 +340,9 @@ public sealed class OutputRenderer : IOutputRenderer
for (var i = 0; i < columns.Count; i++)
{
var value = columns[i].ValueSelector(item) ?? "";
if (columns[i].MaxWidth.HasValue && value.Length > columns[i].MaxWidth.Value)
if (columns[i].MaxWidth is { } maxWidth && value.Length > maxWidth)
{
value = value[..(columns[i].MaxWidth.Value - 3)] + "...";
value = value[..(maxWidth - 3)] + "...";
}
row[i] = value;
widths[i] = Math.Max(widths[i], value.Length);

View File

@@ -359,7 +359,7 @@ internal sealed class ConcelierObservationsClient : IConcelierObservationsClient
private static (string Scope, string CacheKey) BuildScopeAndCacheKey(StellaOpsCliOptions options)
{
var baseScope = AuthorityTokenUtilities.ResolveScope(options);
var finalScope = EnsureScope(baseScope, StellaOpsScopes.VulnRead);
var finalScope = EnsureScope(baseScope, StellaOpsScopes.VulnView);
var credential = !string.IsNullOrWhiteSpace(options.Authority.Username)
? $"user:{options.Authority.Username}"

View File

@@ -65,7 +65,7 @@ public sealed class MirrorBundleImportService : IMirrorBundleImportService
// Register in catalog
var bundleId = GenerateBundleId(manifest);
var manifestDigest = ComputeDigest(File.ReadAllBytes(manifestResult.ManifestPath));
var manifestDigest = ComputeDigest(File.ReadAllBytes(manifestResult.ManifestPath!));
var catalogEntry = new ImportModels.BundleCatalogEntry(
request.TenantId ?? "default",

View File

@@ -861,7 +861,7 @@ internal sealed partial class PromotionAssembler : IPromotionAssembler
try
{
var certBytes = Convert.FromBase64String(sig.Cert);
using var cert = new System.Security.Cryptography.X509Certificates.X509Certificate2(certBytes);
using var cert = System.Security.Cryptography.X509Certificates.X509CertificateLoader.LoadCertificate(certBytes);
// Build PAE for verification
var pae = BuildPae(envelope.PayloadType, envelope.Payload);