pub struct BrowserPolicy { /* private fields */ }Implementations§
Source§impl BrowserPolicy
impl BrowserPolicy
Sourcepub fn from_preset(
preset: PolicyPreset,
workspace_root: impl AsRef<Path>,
) -> Result<Self, PolicyError>
pub fn from_preset( preset: PolicyPreset, workspace_root: impl AsRef<Path>, ) -> Result<Self, PolicyError>
Create a policy from a preset and workspace root.
pub fn development( workspace_root: impl AsRef<Path>, ) -> Result<Self, PolicyError>
pub fn ci(workspace_root: impl AsRef<Path>) -> Result<Self, PolicyError>
pub fn polite(workspace_root: impl AsRef<Path>) -> Result<Self, PolicyError>
pub fn hardened(workspace_root: impl AsRef<Path>) -> Result<Self, PolicyError>
pub fn untrusted_mcp( workspace_root: impl AsRef<Path>, ) -> Result<Self, PolicyError>
pub fn new( preset: PolicyPreset, workspace_root: impl AsRef<Path>, allowed_capabilities: impl IntoIterator<Item = PolicyCapability>, confirmed_capabilities: impl IntoIterator<Item = PolicyCapability>, ) -> Result<Self, PolicyError>
pub fn with_host_rules( self, allowed_hosts: impl IntoIterator<Item = String>, denied_hosts: impl IntoIterator<Item = String>, ) -> Result<Self, PolicyError>
pub fn preset(&self) -> PolicyPreset
pub fn with_confirmation_tokens( self, capabilities: impl IntoIterator<Item = PolicyCapability>, ) -> Result<Self, PolicyError>
pub fn workspace_root(&self) -> &Path
pub async fn prepare_hardened_session( &mut self, attached: bool, ) -> Result<Option<String>, PolicyError>
pub fn decide(&self, capability: PolicyCapability) -> PolicyDecision
pub fn require(&self, capability: PolicyCapability) -> Result<(), PolicyError>
Sourcepub fn require_for_batch(
&self,
capability: PolicyCapability,
) -> Result<(), PolicyError>
pub fn require_for_batch( &self, capability: PolicyCapability, ) -> Result<(), PolicyError>
Check a capability without consuming a confirmation token. Batch preflight uses this so a token cannot be spent before the batch starts or be smuggled into a multi-step request.
Sourcepub fn allow_sensitive_form_values(&self) -> bool
pub fn allow_sensitive_form_values(&self) -> bool
Whether sensitive form values (passwords, CC numbers) may be read.
This capability is denied in ALL presets by default and must be
explicitly added to allowed_capabilities.
pub async fn require_url(&self, value: &str) -> Result<Url, PolicyError>
pub fn require_existing_path( &self, value: &Path, ) -> Result<PathBuf, PolicyError>
pub fn require_output_path(&self, value: &Path) -> Result<PathBuf, PolicyError>
pub fn is_polite(&self) -> bool
Trait Implementations§
Source§impl Clone for BrowserPolicy
impl Clone for BrowserPolicy
Source§fn clone(&self) -> BrowserPolicy
fn clone(&self) -> BrowserPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BrowserPolicy
impl RefUnwindSafe for BrowserPolicy
impl Send for BrowserPolicy
impl Sync for BrowserPolicy
impl Unpin for BrowserPolicy
impl UnsafeUnpin for BrowserPolicy
impl UnwindSafe for BrowserPolicy
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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