part #2
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
// </copyright>
|
||||
|
||||
using System.Collections.Immutable;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace StellaOps.Evidence.Bundle;
|
||||
|
||||
@@ -98,270 +97,3 @@ public sealed class BinaryDiffEvidence
|
||||
/// </summary>
|
||||
public DateTimeOffset? ComputedAt { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Type of binary diff analysis.
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public enum BinaryDiffType
|
||||
{
|
||||
/// <summary>Structural diff (sections, symbols).</summary>
|
||||
Structural,
|
||||
|
||||
/// <summary>Semantic diff (IR-based).</summary>
|
||||
Semantic,
|
||||
|
||||
/// <summary>Combined structural and semantic.</summary>
|
||||
Combined,
|
||||
|
||||
/// <summary>Fast hash-only comparison.</summary>
|
||||
HashOnly
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Function-level diff entry.
|
||||
/// </summary>
|
||||
public sealed class BinaryFunctionDiff
|
||||
{
|
||||
/// <summary>
|
||||
/// Diff operation type.
|
||||
/// </summary>
|
||||
public required BinaryDiffOperation Operation { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Function name or symbol.
|
||||
/// </summary>
|
||||
public required string FunctionName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Function address in previous binary.
|
||||
/// </summary>
|
||||
public ulong? PreviousAddress { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Function address in current binary.
|
||||
/// </summary>
|
||||
public ulong? CurrentAddress { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Previous size in bytes.
|
||||
/// </summary>
|
||||
public int? PreviousSize { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Current size in bytes.
|
||||
/// </summary>
|
||||
public int? CurrentSize { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Semantic similarity score (0.0-1.0) for modified functions.
|
||||
/// </summary>
|
||||
public double? Similarity { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Node hash for the function (for reachability correlation).
|
||||
/// </summary>
|
||||
public string? NodeHash { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether this function is security-sensitive.
|
||||
/// </summary>
|
||||
public bool SecuritySensitive { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Brief description of the change.
|
||||
/// </summary>
|
||||
public string? ChangeDescription { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Symbol-level diff entry.
|
||||
/// </summary>
|
||||
public sealed class BinarySymbolDiff
|
||||
{
|
||||
/// <summary>
|
||||
/// Diff operation type.
|
||||
/// </summary>
|
||||
public required BinaryDiffOperation Operation { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Symbol name.
|
||||
/// </summary>
|
||||
public required string SymbolName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Symbol type (function, object, etc.).
|
||||
/// </summary>
|
||||
public string? SymbolType { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Section containing the symbol.
|
||||
/// </summary>
|
||||
public string? Section { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Symbol visibility.
|
||||
/// </summary>
|
||||
public string? Visibility { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Section-level diff entry.
|
||||
/// </summary>
|
||||
public sealed class BinarySectionDiff
|
||||
{
|
||||
/// <summary>
|
||||
/// Diff operation type.
|
||||
/// </summary>
|
||||
public required BinaryDiffOperation Operation { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Section name.
|
||||
/// </summary>
|
||||
public required string SectionName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Previous section size.
|
||||
/// </summary>
|
||||
public long? PreviousSize { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Current section size.
|
||||
/// </summary>
|
||||
public long? CurrentSize { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Size delta.
|
||||
/// </summary>
|
||||
public long? SizeDelta { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Section permissions/flags.
|
||||
/// </summary>
|
||||
public string? Permissions { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Semantic diff summary.
|
||||
/// </summary>
|
||||
public sealed class BinarySemanticDiff
|
||||
{
|
||||
/// <summary>
|
||||
/// Previous semantic fingerprint hash.
|
||||
/// </summary>
|
||||
public string? PreviousFingerprint { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Current semantic fingerprint hash.
|
||||
/// </summary>
|
||||
public string? CurrentFingerprint { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Overall semantic similarity (0.0-1.0).
|
||||
/// </summary>
|
||||
public double Similarity { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of semantically identical functions.
|
||||
/// </summary>
|
||||
public int IdenticalFunctions { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of semantically similar functions.
|
||||
/// </summary>
|
||||
public int SimilarFunctions { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of semantically different functions.
|
||||
/// </summary>
|
||||
public int DifferentFunctions { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// IR normalization recipe version used.
|
||||
/// </summary>
|
||||
public string? NormalizationRecipe { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Security-relevant change in binary.
|
||||
/// </summary>
|
||||
public sealed class BinarySecurityChange
|
||||
{
|
||||
/// <summary>
|
||||
/// Type of security change.
|
||||
/// </summary>
|
||||
public required BinarySecurityChangeType ChangeType { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Severity of the change (low, medium, high, critical).
|
||||
/// </summary>
|
||||
public required string Severity { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Description of the change.
|
||||
/// </summary>
|
||||
public required string Description { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Affected function or symbol.
|
||||
/// </summary>
|
||||
public string? AffectedSymbol { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// CVE IDs potentially related to this change.
|
||||
/// </summary>
|
||||
public ImmutableArray<string> RelatedCves { get; init; } = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Type of security-relevant change.
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public enum BinarySecurityChangeType
|
||||
{
|
||||
/// <summary>New security-sensitive function added.</summary>
|
||||
SecurityFunctionAdded,
|
||||
|
||||
/// <summary>Security-sensitive function removed.</summary>
|
||||
SecurityFunctionRemoved,
|
||||
|
||||
/// <summary>Security-sensitive function modified.</summary>
|
||||
SecurityFunctionModified,
|
||||
|
||||
/// <summary>Crypto function changed.</summary>
|
||||
CryptoChange,
|
||||
|
||||
/// <summary>Memory safety function changed.</summary>
|
||||
MemorySafetyChange,
|
||||
|
||||
/// <summary>Authentication/authorization function changed.</summary>
|
||||
AuthChange,
|
||||
|
||||
/// <summary>Input validation function changed.</summary>
|
||||
InputValidationChange,
|
||||
|
||||
/// <summary>Hardening feature added or removed.</summary>
|
||||
HardeningChange
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Binary diff operation types.
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public enum BinaryDiffOperation
|
||||
{
|
||||
/// <summary>Element was added.</summary>
|
||||
Added,
|
||||
|
||||
/// <summary>Element was removed.</summary>
|
||||
Removed,
|
||||
|
||||
/// <summary>Element was modified.</summary>
|
||||
Modified,
|
||||
|
||||
/// <summary>Element was renamed.</summary>
|
||||
Renamed,
|
||||
|
||||
/// <summary>Element was moved to different location.</summary>
|
||||
Moved
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user