pub struct ScriptEntity {Show 21 fields
pub id: String,
pub script_type: String,
pub has_writes: bool,
pub has_deletes: bool,
pub total_api_calls: u32,
pub read_calls: u32,
pub write_calls: u32,
pub delete_calls: u32,
pub accessed_paths: HashSet<String>,
pub accessed_methods: HashSet<String>,
pub path_patterns: HashSet<String>,
pub called_operations: HashSet<String>,
pub loop_iterations: u32,
pub nesting_depth: u32,
pub script_length: u32,
pub accesses_sensitive_path: bool,
pub has_unbounded_loop: bool,
pub has_dynamic_path: bool,
pub has_output_declaration: bool,
pub output_fields: HashSet<String>,
pub has_spread_in_output: bool,
}Expand description
Script entity for policy evaluation (OpenAPI Code Mode).
Unlike GraphQL’s single Operation entity, OpenAPI Code Mode validates JavaScript scripts that can contain multiple API calls with loops and logic.
Fields§
§id: StringUnique ID for this script validation
script_type: StringScript type: “read_only”, “mixed”, or “write_only”
has_writes: boolWhether script contains any write operations (POST/PUT/PATCH/DELETE)
has_deletes: boolWhether script contains DELETE operations
total_api_calls: u32Total number of API calls in the script
read_calls: u32Number of GET calls
write_calls: u32Number of POST/PUT/PATCH calls
delete_calls: u32Number of DELETE calls
accessed_paths: HashSet<String>Set of all paths accessed
accessed_methods: HashSet<String>Set of all HTTP methods used
path_patterns: HashSet<String>Normalized path patterns (IDs replaced with *)
called_operations: HashSet<String>Called operations in “METHOD:pathPattern” format for allowlist/blocklist matching
loop_iterations: u32Maximum loop iterations (from .slice() bounds)
nesting_depth: u32Maximum nesting depth in the AST
script_length: u32Script length in characters
accesses_sensitive_path: boolWhether script accesses sensitive paths (/admin, /internal, etc.)
has_unbounded_loop: boolWhether script has an unbounded loop
has_dynamic_path: boolWhether script uses dynamic path interpolation
has_output_declaration: boolWhether script has a @returns output declaration
output_fields: HashSet<String>Fields declared in the @returns annotation
has_spread_in_output: boolWhether script uses spread operators in output (potential field leakage)
Implementations§
Source§impl ScriptEntity
impl ScriptEntity
Sourcepub fn from_javascript_info(
info: &JavaScriptCodeInfo,
sensitive_patterns: &[String],
registry: Option<&OperationRegistry>,
) -> Self
pub fn from_javascript_info( info: &JavaScriptCodeInfo, sensitive_patterns: &[String], registry: Option<&OperationRegistry>, ) -> Self
Build from JavaScript code analysis.
Trait Implementations§
Source§impl Clone for ScriptEntity
impl Clone for ScriptEntity
Source§fn clone(&self) -> ScriptEntity
fn clone(&self) -> ScriptEntity
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ScriptEntity
impl RefUnwindSafe for ScriptEntity
impl Send for ScriptEntity
impl Sync for ScriptEntity
impl Unpin for ScriptEntity
impl UnsafeUnpin for ScriptEntity
impl UnwindSafe for ScriptEntity
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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