Skip to main content

Evidence

Enum Evidence 

Source
#[non_exhaustive]
pub enum Evidence { HttpResponse { status: u16, headers: Vec<(String, String)>, body_excerpt: Option<String>, }, DnsRecord { record_type: String, value: String, }, Banner { raw: String, }, JsSnippet { url: String, line: usize, snippet: String, }, Certificate { subject: String, san: Vec<String>, issuer: String, expires: String, }, CodeSnippet { file: String, line: usize, column: Option<usize>, snippet: String, language: Option<String>, }, HttpRequest { method: String, url: String, headers: Vec<(String, String)>, body: Option<String>, }, PatternMatch { pattern: String, matched: String, }, Raw(String), }
Expand description

Concrete evidence proving a finding is real.

Extensible via #[non_exhaustive] — new evidence types can be added for new tools (firmware, mobile, etc.) without breaking existing consumers.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

HttpResponse

HTTP response data (status, headers, body excerpt).

Fields

§status: u16

HTTP status code.

§headers: Vec<(String, String)>

Response headers as key-value pairs.

§body_excerpt: Option<String>

First N bytes of the response body.

§

DnsRecord

DNS record evidence.

Fields

§record_type: String

Record type (A, AAAA, CNAME, MX, TXT, etc.).

§value: String

Record value.

§

Banner

Service banner captured during port scanning.

Fields

§raw: String

Raw banner text.

§

JsSnippet

JavaScript source snippet with context.

Fields

§url: String

URL of the JS file.

§line: usize

Line number in the file.

§snippet: String

The matched code snippet.

§

Certificate

TLS certificate information.

Fields

§subject: String

Certificate subject (CN).

§san: Vec<String>

Subject Alternative Names.

§issuer: String

Certificate issuer.

§expires: String

Expiration date.

§

CodeSnippet

Source code snippet (for SAST, malware detection).

Fields

§file: String

File path.

§line: usize

Line number.

§column: Option<usize>

Column number (optional).

§snippet: String

The matched code.

§language: Option<String>

Programming language.

§

HttpRequest

HTTP request that triggered the finding (for template/vuln scanners).

Fields

§method: String

HTTP method.

§url: String

Full URL.

§headers: Vec<(String, String)>

Request headers.

§body: Option<String>

Request body.

§

PatternMatch

Matched pattern or regex (for pattern-based scanners).

Fields

§pattern: String

The pattern or regex that matched.

§matched: String

The matched content.

§

Raw(String)

Unstructured evidence — fallback for anything that doesn’t fit above.

Implementations§

Source§

impl Evidence

Source

pub fn http_status(status: u16) -> Result<Self, &'static str>

Create an HTTP response evidence with just a status code.

Examples found in repository?
examples/basic.rs (line 8)
3fn main() {
4    let finding = Finding::builder("basic-scanner", "https://example.com", Severity::High)
5        .title("Potential command injection")
6        .detail("Untrusted input reaches shell execution")
7        .tag("rce")
8        .evidence(secfinding::Evidence::http_status(500).unwrap())
9        .build()
10        .unwrap();
11
12    println!("{finding}");
13
14    let json = serde_json::to_string_pretty(&finding).unwrap();
15    println!("{json}");
16}
Source

pub fn code( file: impl Into<String>, line: usize, snippet: impl Into<String>, column: Option<usize>, language: Option<String>, ) -> Self

Create a code snippet evidence.

Trait Implementations§

Source§

impl Clone for Evidence

Source§

fn clone(&self) -> Evidence

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Evidence

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Evidence

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Evidence

Source§

fn eq(&self, other: &Evidence) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Evidence

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for Evidence

Source§

impl StructuralPartialEq for Evidence

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,