Skip to main content

FirewallConfig

Struct FirewallConfig 

Source
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: usize

ISS-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

Source§

fn clone(&self) -> FirewallConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FirewallConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for FirewallConfig

Source§

fn default() -> FirewallConfig

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.