pub struct JavaScriptValidator { /* private fields */ }Expand description
JavaScript code validator for OpenAPI Code Mode.
Implementations§
Source§impl JavaScriptValidator
impl JavaScriptValidator
Sourcepub fn new(
sensitive_paths: Vec<String>,
max_depth: usize,
max_api_calls: usize,
max_loops: usize,
max_statements: usize,
) -> Self
pub fn new( sensitive_paths: Vec<String>, max_depth: usize, max_api_calls: usize, max_loops: usize, max_statements: usize, ) -> Self
Create a new validator with custom settings.
Sourcepub fn with_sdk_operations(self, operations: HashSet<String>) -> Self
pub fn with_sdk_operations(self, operations: HashSet<String>) -> Self
Set the allowed SDK operation names. When non-empty, the validator operates in SDK mode:
known SDK operations are accepted, unknown ones generate UnknownApiCall violations.
Sourcepub fn check_output_against_blocklist(
declaration: &OutputDeclaration,
blocked_fields: &HashSet<String>,
) -> Vec<String>
pub fn check_output_against_blocklist( declaration: &OutputDeclaration, blocked_fields: &HashSet<String>, ) -> Vec<String>
Check if declared output fields contain any blocked fields.
Sourcepub fn validate(
&self,
code: &str,
) -> Result<JavaScriptCodeInfo, ValidationError>
pub fn validate( &self, code: &str, ) -> Result<JavaScriptCodeInfo, ValidationError>
Parse and validate JavaScript code.
Sourcepub fn analyze_security(&self, info: &JavaScriptCodeInfo) -> SecurityAnalysis
pub fn analyze_security(&self, info: &JavaScriptCodeInfo) -> SecurityAnalysis
Perform security analysis on code info.
Sourcepub fn to_code_type(&self, info: &JavaScriptCodeInfo) -> CodeType
pub fn to_code_type(&self, info: &JavaScriptCodeInfo) -> CodeType
Convert code info to CodeType.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JavaScriptValidator
impl RefUnwindSafe for JavaScriptValidator
impl Send for JavaScriptValidator
impl Sync for JavaScriptValidator
impl Unpin for JavaScriptValidator
impl UnsafeUnpin for JavaScriptValidator
impl UnwindSafe for JavaScriptValidator
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 moreCreates a shared type from an unshared type.