pub struct Finding {
pub invariant_id: String,
pub severity: Severity,
pub file: String,
pub line: usize,
pub col: usize,
pub message: String,
pub snippet: String,
pub source_fragment: Option<String>,
pub transaction_hash: Option<String>,
pub metadata: BTreeMap<String, String>,
}Expand description
A security finding discovered by a detector.
This is the unified output type for all invariant violations, accessible across EVM, Solana, Move, and other analyzers.
Fields§
§invariant_id: StringUnique identifier for the invariant that was violated. Example: “evm_reentrancy_classic”, “sol_missing_signer”, “move_access_control_missing”
severity: SeveritySeverity of this finding.
file: StringSource file path (relative to project root).
line: usizeLine number in source file (1-indexed).
col: usizeColumn number in source file (0-indexed).
message: StringHuman-readable description of the finding. Should explain what was found and why it’s a problem.
snippet: StringCode snippet showing the problematic code (for context in reports). Include a few lines of context around the issue.
source_fragment: Option<String>Optional source code fragment (full function or smaller unit). Useful for detailed analysis.
transaction_hash: Option<String>Optional transaction hash or test case ID (for runtime detections).
metadata: BTreeMap<String, String>Additional metadata (chain, detector version, etc). Can be used by report formatters.
Implementations§
Source§impl Finding
impl Finding
Sourcepub fn new(
invariant_id: String,
severity: Severity,
file: String,
line: usize,
col: usize,
message: String,
snippet: String,
) -> Self
pub fn new( invariant_id: String, severity: Severity, file: String, line: usize, col: usize, message: String, snippet: String, ) -> Self
Create a new finding.
Sourcepub fn with_metadata(self, key: String, value: String) -> Self
pub fn with_metadata(self, key: String, value: String) -> Self
Add metadata to this finding.
Sourcepub fn with_source_fragment(self, fragment: String) -> Self
pub fn with_source_fragment(self, fragment: String) -> Self
Set the source fragment for this finding.
Sourcepub fn with_transaction_hash(self, tx_hash: String) -> Self
pub fn with_transaction_hash(self, tx_hash: String) -> Self
Set the transaction hash for this finding (runtime detections).