pub struct FindingBuilder { /* private fields */ }Expand description
Builder for constructing findings with a fluent API.
Required fields are set in Finding::builder. Optional fields
are added via chained methods.
Implementations§
Source§impl FindingBuilder
impl FindingBuilder
Sourcepub fn title(self, title: impl Into<String>) -> Self
pub fn title(self, title: impl Into<String>) -> Self
Set the finding title.
Examples found in repository?
More examples
examples/basic.rs (line 5)
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}Sourcepub fn detail(self, detail: impl Into<String>) -> Self
pub fn detail(self, detail: impl Into<String>) -> Self
Set the finding detail/description.
Examples found in repository?
More examples
examples/basic.rs (line 6)
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}Sourcepub fn kind(self, kind: FindingKind) -> Self
pub fn kind(self, kind: FindingKind) -> Self
Set the finding kind.
Sourcepub fn evidence(self, ev: Evidence) -> Self
pub fn evidence(self, ev: Evidence) -> Self
Add a piece of evidence.
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}Sourcepub fn tag(self, tag: impl Into<String>) -> Self
pub fn tag(self, tag: impl Into<String>) -> Self
Add a tag.
Examples found in repository?
More examples
examples/basic.rs (line 7)
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}Sourcepub fn confidence(self, score: f64) -> Self
pub fn confidence(self, score: f64) -> Self
Set the confidence score (0.0 to 1.0).
Sourcepub fn exploit_hint(self, hint: impl Into<String>) -> Self
pub fn exploit_hint(self, hint: impl Into<String>) -> Self
Set a ready-to-run exploit/PoC command.
Sourcepub fn matched_value(self, value: impl Into<String>) -> Self
pub fn matched_value(self, value: impl Into<String>) -> Self
Add a matched value (payload, string, etc.).
Sourcepub fn build(self) -> Result<Finding, &'static str>
pub fn build(self) -> Result<Finding, &'static str>
Build the finding.
Examples found in repository?
More examples
examples/basic.rs (line 9)
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}Trait Implementations§
Source§impl Clone for FindingBuilder
impl Clone for FindingBuilder
Source§fn clone(&self) -> FindingBuilder
fn clone(&self) -> FindingBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FindingBuilder
impl Debug for FindingBuilder
Source§impl PartialEq for FindingBuilder
impl PartialEq for FindingBuilder
impl StructuralPartialEq for FindingBuilder
Auto Trait Implementations§
impl Freeze for FindingBuilder
impl RefUnwindSafe for FindingBuilder
impl Send for FindingBuilder
impl Sync for FindingBuilder
impl Unpin for FindingBuilder
impl UnsafeUnpin for FindingBuilder
impl UnwindSafe for FindingBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more