pub struct RepoPolicy {
pub version: u32,
pub deny: Vec<RuleGroup>,
pub allow: Vec<RuleGroup>,
pub ask: Vec<RuleGroup>,
}Expand description
A repository policy. Only rules: defaults, executables and sandbox
stay the user’s, so any other key is a parse error.
Fields§
§version: u32Schema version; only 1 is supported.
deny: Vec<RuleGroup>Added to the user’s deny rules.
allow: Vec<RuleGroup>Added to the user’s allow rules, only when the file is trusted.
ask: Vec<RuleGroup>Tried before the user’s allow rules.
Implementations§
Source§impl RepoPolicy
impl RepoPolicy
Sourcepub fn parse(yaml: &str) -> Result<Self, PolicyError>
pub fn parse(yaml: &str) -> Result<Self, PolicyError>
Parse and lint a repository policy. Pure: takes the YAML text.
Sourcepub fn merge(&self, user: &Policy, trusted: bool) -> Result<Policy, PolicyError>
pub fn merge(&self, user: &Policy, trusted: bool) -> Result<Policy, PolicyError>
user with this policy merged in; its allow rules only when trusted.
The user’s deny rules still come first, so even a trusted repository
cannot allow what the user denies.
Sourcepub fn merge_deny(&self, user: &Policy) -> Result<Policy, PolicyError>
pub fn merge_deny(&self, user: &Policy) -> Result<Policy, PolicyError>
user with only this policy’s deny rules added: what openmoat run’s
proxy decides hosts with. Its ask rules are left out, since the proxy
cannot ask and a team’s “ask before any network” would cut the run off,
and its allow rules too, trusted or not: they would widen the proxy.