pub struct ScriptPolicy {
pub shell: bool,
pub python: bool,
pub lua: bool,
pub timeout_ms: u64,
pub total_timeout_s: u64,
pub trusted: Vec<String>,
}Expand description
What external scripts may do on one request. The daemon builds it from the
settings (rewrite.external_scripts, the timeouts) and the repository’s
trust store, and replaces whatever a client sent: a frontend cannot grant
itself anything. The default is the safe one a bare backend (a test)
sees: shell scripts allowed, Python and external Lua off, nothing trusted.
Fields§
§shell: bool§python: bool§lua: bool§timeout_ms: u64Per-request timeout in milliseconds.
total_timeout_s: u64Whole-pass timeout in seconds.
trusted: Vec<String>Content hashes (script_hash) the user trusted, plus the ones the
caller vouched for on this request (a script the user typed).
Implementations§
Source§impl ScriptPolicy
impl ScriptPolicy
pub fn is_default(&self) -> bool
Sourcepub fn allows(&self, language: ScriptLanguage) -> bool
pub fn allows(&self, language: ScriptLanguage) -> bool
Whether the settings allow language (the embedded Lua always).
pub fn trusts(&self, hash: &str) -> bool
Sourcepub fn from_settings(
enabled: &[String],
timeout_ms: u64,
total_timeout_s: u64,
) -> Self
pub fn from_settings( enabled: &[String], timeout_ms: u64, total_timeout_s: u64, ) -> Self
The policy for a rewrite.external_scripts list (shell, python,
lua) and the two timeouts (0 reads as the default).
Trait Implementations§
Source§impl Clone for ScriptPolicy
impl Clone for ScriptPolicy
Source§impl Debug for ScriptPolicy
impl Debug for ScriptPolicy
Source§impl Default for ScriptPolicy
impl Default for ScriptPolicy
Source§impl<'de> Deserialize<'de> for ScriptPolicywhere
ScriptPolicy: Default,
impl<'de> Deserialize<'de> for ScriptPolicywhere
ScriptPolicy: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ScriptPolicy
Source§impl PartialEq for ScriptPolicy
impl PartialEq for ScriptPolicy
Source§impl Serialize for ScriptPolicy
impl Serialize for ScriptPolicy
impl StructuralPartialEq for ScriptPolicy
Auto Trait Implementations§
impl Forget for ScriptPolicy
impl Freeze for ScriptPolicy
impl Move for ScriptPolicy
impl RefUnwindSafe for ScriptPolicy
impl Send for ScriptPolicy
impl Sync for ScriptPolicy
impl Unpin for ScriptPolicy
impl UnsafeUnpin for ScriptPolicy
impl UnwindSafe for ScriptPolicy
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