pub struct NetworkPolicy {
pub enabled: bool,
pub allow_domains: Vec<String>,
pub deny_domains: Vec<String>,
}Expand description
P4c (S2 module 5 tools.web, S2.1 dep “network sandbox rules”, S17):
the network-domain policy a caller (SDK embedder) may install on a
ToolContext so crate::tools::WebFetchTool/crate::tools::WebSearchTool
respect it — see ToolContext::check_network. None on the context
(the default) means no policy is configured, matching today’s honest
gap (no P5 capabilities.permissions.sandbox.network engine exists
yet, C3 — tracked, not hidden).
Fields§
§enabled: boolWhether the policy is enforced at all. false behaves exactly like
None on the context.
allow_domains: Vec<String>If non-empty, only these hosts are allowed. BP-10: matched as
crate::config::glob_match patterns through the one rule engine
(domain(<entry>)), so a bare hostname still matches exactly as
before and *.example.com now works too.
deny_domains: Vec<String>These hosts are always denied, even if also present in
allow_domains. Same pattern treatment as Self::allow_domains.
Implementations§
Source§impl NetworkPolicy
impl NetworkPolicy
Sourcepub fn domain_rule_set(&self) -> (RuleSet, Decision)
pub fn domain_rule_set(&self) -> (RuleSet, Decision)
BP-10 (catalog row “Allow/ask/deny rule language”, the DOMAIN
subject): this policy’s two lists expressed IN the rule algebra —
a crate::permissions::RuleSet of domain(...) patterns plus
the baseline crate::permissions::Decision a host matching
nothing gets.
An allowlist is not a deny rule: in a deny→ask→allow FIRST-MATCH
engine “only these hosts” is expressed by the BASELINE being
Deny, with each allowed host in the allow tier — a
domain(*) deny rule would (correctly, per tier priority) also
swallow the allowlist. Empty allow_domains keeps the baseline
Allow, which is why a pure denylist behaves exactly as it did
before this translation existed.
Trait Implementations§
Source§impl Clone for NetworkPolicy
impl Clone for NetworkPolicy
Source§fn clone(&self) -> NetworkPolicy
fn clone(&self) -> NetworkPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more