claude_agent/security/
error.rs

1//! Security error types.
2
3use std::path::PathBuf;
4use thiserror::Error;
5
6#[derive(Debug, Error)]
7pub enum SecurityError {
8    #[error("path escapes sandbox: {0}")]
9    PathEscape(PathBuf),
10
11    #[error("absolute symlink outside sandbox: {0}")]
12    AbsoluteSymlink(PathBuf),
13
14    #[error("symlink depth exceeded (max {max}): {path}")]
15    SymlinkDepthExceeded { path: PathBuf, max: u8 },
16
17    #[error("invalid path: {0}")]
18    InvalidPath(String),
19
20    #[error("denied path: {0}")]
21    DeniedPath(PathBuf),
22
23    #[error("bash command blocked: {0}")]
24    BashBlocked(String),
25
26    #[error("path not within sandbox: {0}")]
27    NotWithinSandbox(PathBuf),
28
29    #[error("IO error: {0}")]
30    Io(#[from] std::io::Error),
31
32    #[error("resource limit error: {0}")]
33    ResourceLimit(String),
34}