Skip to main content

ScriptEntity

Struct ScriptEntity 

Source
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: String

Unique ID for this script validation

§script_type: String

Script type: “read_only”, “mixed”, or “write_only”

§has_writes: bool

Whether script contains any write operations (POST/PUT/PATCH/DELETE)

§has_deletes: bool

Whether script contains DELETE operations

§total_api_calls: u32

Total number of API calls in the script

§read_calls: u32

Number of GET calls

§write_calls: u32

Number of POST/PUT/PATCH calls

§delete_calls: u32

Number 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: u32

Maximum loop iterations (from .slice() bounds)

§nesting_depth: u32

Maximum nesting depth in the AST

§script_length: u32

Script length in characters

§accesses_sensitive_path: bool

Whether script accesses sensitive paths (/admin, /internal, etc.)

§has_unbounded_loop: bool

Whether script has an unbounded loop

§has_dynamic_path: bool

Whether script uses dynamic path interpolation

§has_output_declaration: bool

Whether script has a @returns output declaration

§output_fields: HashSet<String>

Fields declared in the @returns annotation

§has_spread_in_output: bool

Whether script uses spread operators in output (potential field leakage)

Implementations§

Source§

impl ScriptEntity

Source

pub fn from_javascript_info( info: &JavaScriptCodeInfo, sensitive_patterns: &[String], registry: Option<&OperationRegistry>, ) -> Self

Build from JavaScript code analysis.

Source

pub fn action(&self) -> &'static str

Get the policy action for this script using unified action model.

Trait Implementations§

Source§

impl Clone for ScriptEntity

Source§

fn clone(&self) -> ScriptEntity

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 ScriptEntity

Source§

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

Formats the value using the given formatter. Read more

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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

Source§

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