use std::path::PathBuf;
use cageforge_command::EnvironmentSpec;
use cageforge_policy::{NetworkMode, NetworkPolicy, SandboxPolicy};
use crate::environment::EffectiveEnvironment;
use crate::filesystem::EffectiveFilesystemPolicy;
use crate::ownership::ExternalOwner;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PolicyCeiling {
pub(super) policy: SandboxPolicy,
pub(super) environment: EnvironmentSpec,
pub(super) workspace_roots: Option<Vec<PathBuf>>,
pub(super) external_owner: Option<ExternalOwner>,
}
#[derive(Debug, Clone)]
pub struct CompositionRequest<'a> {
pub(crate) requested_policy: &'a SandboxPolicy,
pub(crate) requested_environment: &'a EnvironmentSpec,
pub(crate) requested_workspace_roots: Option<Vec<PathBuf>>,
pub(crate) ceiling: &'a PolicyCeiling,
pub(crate) external_owner: Option<ExternalOwner>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct EffectiveSandbox {
pub(super) filesystem: EffectiveFilesystemPolicy,
pub(super) network: EffectiveNetworkPolicy,
pub(super) environment: EffectiveEnvironment,
pub(super) workspace_roots: Option<Vec<PathBuf>>,
pub(super) workspace_root_limit: Option<Vec<PathBuf>>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct EffectiveNetworkPolicy {
pub(super) requested: NetworkPolicy,
pub(super) ceiling: NetworkPolicy,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct EffectiveNetworkRequirements {
pub(super) mode: NetworkMode,
pub(super) domain_rules: bool,
pub(super) local_address_restrictions: bool,
pub(super) resolved_targets: bool,
pub(super) local_ipc_isolation: bool,
pub(super) local_ipc_rules: bool,
pub(super) local_ipc_deny_rules: bool,
pub(super) windows_named_pipe_rules: bool,
}