pub struct FirewallConfig {
pub project_roots: Vec<String>,
pub allowed_hosts: Vec<String>,
pub allowed_scopes: HashMap<String, Vec<String>>,
pub approval_ttl_secs: u64,
pub long_text_threshold: usize,
}Expand description
Firewall 配置:项目根 / 允许主机 / OAuth scope allowlist / TTL 等。
Fields§
§project_roots: Vec<String>POSIX 规范化的项目根目录前缀
allowed_hosts: Vec<String>允许的主机列表(支持 .github.com 风格的后缀模式由 policy 的
host_matches 实现;Firewall 这层只作为 RiskScorer 与 PolicyContext 的输入)
allowed_scopes: HashMap<String, Vec<String>>I10c-β2(R3 BLOCKER 修复):OAuth scope allowlist 注入通道。
键是 Condition::ScopeNotInAllowList::allowlist_key 引用的逻辑名
(如 "oauth_scopes" / "github_scopes" / "gitlab_scopes"),值是该 AS
允许的 scope 白名单。Firewall 在评估前把 entry 合并到 PolicyContext.allowlists,
与 allowed_hosts(固定键 "allowed_hosts")并列。
命名隔离约定:请勿在此 map 里使用键 "allowed_hosts",避免与 host allowlist
冲突;Firewall 不做 runtime 检查(类型上共享 HashMap<String, Vec<String>>),
配置加载层自行保证键不相撞。
approval_ttl_secs: u64审批 TTL 秒。默认 300(5 分钟)。0 表示立即过期(供测试)。
long_text_threshold: usizeISS-010:T0 preflight 扫描的长文本阈值(字节)。
Firewall::evaluate 递归 ToolInvocation.args 里的所有字符串字段,长度 ≥
此阈值的才送进 vigil_redaction::scan_text。默认 100(覆盖典型提示词 / 邮件
正文 / SQL 大段,放过短工具参数如 "path": "/etc/hosts")。
边界:本阈值以 str::len()(UTF-8 bytes)为准,而非字符数;ASCII 场景下
等同于 char count。取 0 等同 “扫所有字符串”(含空串 —— 但空串在 scan_text 层
会被当 EmptyInput continue,不会误触 fail-closed)。
Trait Implementations§
Source§impl Clone for FirewallConfig
impl Clone for FirewallConfig
Source§fn clone(&self) -> FirewallConfig
fn clone(&self) -> FirewallConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more