pub struct SecurityScanner { /* private fields */ }Expand description
Security scanner for analyzing code changes.
Implementations§
Source§impl SecurityScanner
impl SecurityScanner
Sourcepub fn with_config(config: SecurityConfig) -> Self
pub fn with_config(config: SecurityConfig) -> Self
Sourcepub fn scan_diff(&self, diff: &str) -> Vec<Finding>
pub fn scan_diff(&self, diff: &str) -> Vec<Finding>
Scans a PR diff for security vulnerabilities.
Prompt-injection patterns (ids prefixed with prompt-injection) are included
in the results alongside code security findings. Callers that only want injection
findings can filter by finding.pattern_id.starts_with("prompt-injection").
§Arguments
diff- The unified diff text from a pull request
§Returns
A vector of security findings from added/modified lines.
Sourcepub fn scan_file(&self, content: &str, file_path: &str) -> Vec<Finding>
pub fn scan_file(&self, content: &str, file_path: &str) -> Vec<Finding>
Scans file content directly (not a diff).
Skips scanning entirely if the file path is in an ignored directory. Otherwise, filters out findings based on configured ignore rules.
§Arguments
content- The file content to scanfile_path- Path to the file
§Returns
A vector of security findings, excluding ignored patterns and paths.
Trait Implementations§
Source§impl Debug for SecurityScanner
impl Debug for SecurityScanner
Auto Trait Implementations§
impl Freeze for SecurityScanner
impl RefUnwindSafe for SecurityScanner
impl Send for SecurityScanner
impl Sync for SecurityScanner
impl Unpin for SecurityScanner
impl UnsafeUnpin for SecurityScanner
impl UnwindSafe for SecurityScanner
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more