Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fc404a7
feat(agent): add ai agent enforcement config
kylewanginchina May 12, 2026
5529446
feat(agent): add ai agent enforcement strategies
kylewanginchina May 12, 2026
fcd3798
feat(agent): add proc block event model
kylewanginchina May 12, 2026
00ef425
feat(server): route ai agent block events
kylewanginchina May 12, 2026
2f4a974
feat(server): add proc block event schema
kylewanginchina May 12, 2026
da5c0ca
feat(agent): detect kernel enforcement capabilities
kylewanginchina May 12, 2026
272544c
feat(agent): emit audit-only ai agent block events
kylewanginchina May 12, 2026
c89487c
feat(ebpf): support loading lsm programs
kylewanginchina May 12, 2026
ca7f3b0
fix(ebpf): keep optional lsm programs non-fatal
kylewanginchina May 12, 2026
7742c79
test(ebpf): assert ai agent exec enforcement contract
kylewanginchina May 12, 2026
bdff01e
feat(agent): sync ai agent enforcement policy to bpf
kylewanginchina May 12, 2026
7eebc06
fix(ebpf): harden ai agent exec lsm enforcement
kylewanginchina May 13, 2026
ceeaeca
feat(agent): support ai agent syscall override enforcement
kylewanginchina May 13, 2026
247ae19
fix(server): gofmt native tag table names
kylewanginchina May 13, 2026
c67f890
feat(agent): support ai agent argv enforcement
kylewanginchina May 14, 2026
e12e06a
fix(server): add proc block event upgrade issue
kylewanginchina May 18, 2026
d1465af
feat(agent): raise ai agent exec rule cap to 256
kylewanginchina May 18, 2026
ac15b71
docs(agent): clarify ai agent enforcement config
kylewanginchina May 19, 2026
02f664b
feat(agent): support ai agent process matcher recognition
kylewanginchina May 20, 2026
507fdcd
fix(agent): propagate ai agent biz type to ebpf l7 logs
kylewanginchina May 21, 2026
1d998ef
fix(ebpf): avoid double output on 5.2+ syscall path
kylewanginchina May 21, 2026
c59847e
fix(agent): deduplicate exec audit events
kylewanginchina May 27, 2026
8f247ea
fix(agent): retry block event delivery and backfill best effort
kylewanginchina May 28, 2026
cab55fa
feat(agent): support ai agent exec for cmdline prefixes
kylewanginchina May 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 159 additions & 0 deletions agent/crates/enterprise-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,152 @@ pub mod kernel_version {
}
}

pub mod ai_agent_enforcement {
use std::sync::Arc;

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum EnforcementMode {
AuditOnly,
Block,
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ExecRuleInput {
pub id: String,
pub mode: EnforcementMode,
pub exact: Vec<String>,
pub prefix: Vec<String>,
pub suffix: Vec<String>,
pub argv_matches: Vec<ExecArgvMatchInput>,
pub cmdline_prefixes: Vec<String>,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ExecArgvMatchOp {
Exact,
Prefix,
Suffix,
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ExecArgvMatchInput {
pub index: u8,
pub op: ExecArgvMatchOp,
pub value: String,
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct SyscallRuleInput {
pub id: String,
pub mode: EnforcementMode,
pub names: Vec<String>,
pub symbols: Vec<String>,
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct PolicyHit {
pub rule_index: u32,
pub rule_id: String,
pub mode: EnforcementMode,
pub kernel_event_source: KernelEventSource,
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum KernelEventSource {
None,
Lsm,
KprobeOverride,
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CompiledExecPolicy {
pub epoch: u64,
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CompiledSyscallPolicy {
pub epoch: u64,
}

impl CompiledExecPolicy {
pub fn match_exec(&self, _exec_path: &str, _cmdline: &str) -> Option<PolicyHit> {
None
}

pub fn sync_to_bpf_maps(
&self,
_exec_rules_fd: i32,
_policy_epoch_fd: i32,
_max_records: usize,
) -> Result<(), String> {
Ok(())
}
}

impl CompiledSyscallPolicy {
pub fn to_bpf_records(&self) -> Vec<BpfSyscallRuleRecord> {
vec![]
}

pub fn sync_to_bpf_maps(
&self,
_syscall_rules_fd: i32,
_policy_epoch_fd: i32,
_max_records: usize,
) -> Result<(), String> {
Ok(())
}
}

#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct BpfSyscallRuleRecord {
pub rule_index: u32,
pub mode: u8,
pub syscall_key: u8,
pub reserved: u16,
pub syscall_id: u32,
pub errno_code: i32,
pub rule_id: [u8; 64],
pub syscall_name: [u8; 32],
}

impl Default for BpfSyscallRuleRecord {
fn default() -> Self {
Self {
rule_index: 0,
mode: 0,
syscall_key: 0,
reserved: 0,
syscall_id: 0,
errno_code: 0,
rule_id: [0; 64],
syscall_name: [0; 32],
}
}
}

pub fn compile_exec_rules(_rules: &[ExecRuleInput]) -> Result<CompiledExecPolicy, String> {
Ok(CompiledExecPolicy { epoch: 0 })
}

pub fn compile_syscall_rules(
_rules: &[SyscallRuleInput],
) -> Result<CompiledSyscallPolicy, String> {
Ok(CompiledSyscallPolicy { epoch: 0 })
}

pub fn syscall_override_symbols(_syscall_key: u8) -> &'static [&'static str] {
&[]
}

pub fn set_global_exec_policy(_policy: Option<CompiledExecPolicy>) {}

pub fn global_exec_policy() -> Option<Arc<CompiledExecPolicy>> {
None
}
}

#[cfg(any(target_os = "linux", target_os = "android"))]
pub mod rpc {
pub mod remote_exec {
Expand Down Expand Up @@ -534,6 +680,15 @@ pub mod ai_agent {
false
}

pub fn register_process_matcher(
&self,
_pid: u32,
_process_name: &str,
_now: Duration,
) -> bool {
false
}

pub fn is_ai_agent(&self, _pid: u32) -> bool {
false
}
Expand All @@ -554,6 +709,10 @@ pub mod ai_agent {
vec![]
}

pub fn remove_process_matcher_root(&self, _root_pid: u32) -> Vec<u32> {
vec![]
}

pub fn len(&self) -> usize {
0
}
Expand Down
1 change: 1 addition & 0 deletions agent/src/common/ebpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub const UNIX_SOCKET: u8 = 8;
pub const FILE_OP_EVENT: u8 = 9;
pub const PERM_OP_EVENT: u8 = 10;
pub const PROC_LIFECYCLE_EVENT: u8 = 11;
pub const PROC_BLOCK_EVENT: u8 = 12;

const EBPF_TYPE_TRACEPOINT: u8 = 0;
const EBPF_TYPE_TLS_UPROBE: u8 = 1;
Expand Down
Loading
Loading