guards/egress_allowlist.rs

clawdstrike · crates/libs/clawdstrike-logos/src/guards/egress_allowlist.rs · rust · Apache-2.0
ai, AI / Agents

Implements translation of EgressAllowlistConfig into policy formulas for agent permissions and prohibitions.

// Source: https://github.com/backbay-labs/clawdstrike | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
//! Formula translation for [`EgressAllowlistConfig`].

use clawdstrike::guards::EgressAllowlistConfig;
use hush_proxy::policy::PolicyAction;
use logos_ffi::{AgentId, Formula};

use super::GuardFormulas;
use crate::atoms::ActionAtom;

impl GuardFormulas for EgressAllowlistConfig {
    /// `P_agent(egress(d))` per allow, `F_agent(egress(d))` per block,
    /// plus a wildcard default (`egress(*)`).
    fn to_formulas(&self, agent: &AgentId) -> Vec<Formula> {
        if !self.enabled {
            return vec![];
        }

        let permissions = self.effective_allow_patterns().i

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key