release orchestrator v1 draft and build fixes
This commit is contained in:
@@ -1,86 +1,4 @@
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace StellaOps.Scanner.CallGraph;
|
||||
|
||||
/// <summary>
|
||||
/// Configuration options for <see cref="ReachabilityAnalyzer"/>.
|
||||
/// Defines limits and ordering rules for deterministic path output.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Sprint: SPRINT_3700_0001_0001 (WIT-007A, WIT-007B)
|
||||
/// Contract: ReachabilityAnalyzer → PathWitnessBuilder output contract
|
||||
///
|
||||
/// Determinism guarantees:
|
||||
/// - Paths are ordered by (SinkId ASC, EntrypointId ASC, PathLength ASC)
|
||||
/// - Node IDs within paths are ordered from entrypoint to sink (caller → callee)
|
||||
/// - Maximum caps prevent unbounded output
|
||||
/// </remarks>
|
||||
public sealed record ReachabilityAnalysisOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Default options with sensible limits.
|
||||
/// </summary>
|
||||
public static ReachabilityAnalysisOptions Default { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Maximum depth for BFS traversal (0 = unlimited, default = 256).
|
||||
/// Prevents infinite loops in cyclic graphs.
|
||||
/// </summary>
|
||||
public int MaxDepth { get; init; } = 256;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum number of paths to return per sink (default = 10).
|
||||
/// Limits witness explosion when many entrypoints reach the same sink.
|
||||
/// </summary>
|
||||
public int MaxPathsPerSink { get; init; } = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum total paths to return (default = 100).
|
||||
/// Hard cap to prevent memory issues with highly connected graphs.
|
||||
/// </summary>
|
||||
public int MaxTotalPaths { get; init; } = 100;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to include node metadata in path reconstruction (default = true).
|
||||
/// When false, paths only contain node IDs without additional context.
|
||||
/// </summary>
|
||||
public bool IncludeNodeMetadata { get; init; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Explicit list of sink node IDs to target (default = null, meaning use snapshot.SinkIds).
|
||||
/// When set, analysis will only find paths to these specific sinks.
|
||||
/// This enables targeted witness generation for specific vulnerabilities.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Sprint: SPRINT_3700_0001_0001 (WIT-007B)
|
||||
/// Enables: PathWitnessBuilder can request paths to specific trigger methods.
|
||||
/// </remarks>
|
||||
public ImmutableArray<string>? ExplicitSinks { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Validates options and returns sanitized values.
|
||||
/// </summary>
|
||||
public ReachabilityAnalysisOptions Validated()
|
||||
{
|
||||
// Normalize explicit sinks: trim, dedupe, order
|
||||
ImmutableArray<string>? normalizedSinks = null;
|
||||
if (ExplicitSinks.HasValue && !ExplicitSinks.Value.IsDefaultOrEmpty)
|
||||
{
|
||||
normalizedSinks = ExplicitSinks.Value
|
||||
.Where(s => !string.IsNullOrWhiteSpace(s))
|
||||
.Select(s => s.Trim())
|
||||
.Distinct(StringComparer.Ordinal)
|
||||
.OrderBy(s => s, StringComparer.Ordinal)
|
||||
.ToImmutableArray();
|
||||
}
|
||||
|
||||
return new ReachabilityAnalysisOptions
|
||||
{
|
||||
MaxDepth = MaxDepth <= 0 ? 256 : Math.Min(MaxDepth, 1024),
|
||||
MaxPathsPerSink = MaxPathsPerSink <= 0 ? 10 : Math.Min(MaxPathsPerSink, 100),
|
||||
MaxTotalPaths = MaxTotalPaths <= 0 ? 100 : Math.Min(MaxTotalPaths, 1000),
|
||||
IncludeNodeMetadata = IncludeNodeMetadata,
|
||||
ExplicitSinks = normalizedSinks
|
||||
};
|
||||
}
|
||||
}
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
// Copyright (c) StellaOps
|
||||
// ReachabilityAnalysisOptions is now defined in StellaOps.Scanner.Contracts.
|
||||
// This file exists only for file system tracking - the type is imported via global using.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Immutable;
|
||||
using StellaOps.Scanner.Contracts;
|
||||
|
||||
namespace StellaOps.Scanner.CallGraph;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user