← Về thư mục
openai4s/security/sandbox.py
- SandboxError · class · L71-L72 — class SandboxError(RuntimeError)
- SandboxConfigurationError · class · L75-L76 — class SandboxConfigurationError(SandboxError)
- SandboxUnavailableError · class · L79-L80 — class SandboxUnavailableError(SandboxError)
- SandboxStatus · class · L84-L108 — class SandboxStatus
- to_dict · method · L98-L99 — def to_dict(self) -> dict[str, Any]
- host_only_boundary_holds · method · L101-L108 — def host_only_boundary_holds(self) -> bool
- KernelReadIsolation · class · L112-L141 — class KernelReadIsolation
- with_allowed_roots · method · L124-L133 — def with_allowed_roots( self, roots: Sequence[str | os.PathLike[str] | None] ) -> "KernelReadIsolation"
- with_roots · method · L135-L141 — def with_roots( self, roots: Sequence[str | os.PathLike[str]] ) -> "KernelReadIsolation"
- _parse_bool · function · L144-L154 — def _parse_bool(value: str | None, *, name: str, default: bool = False) -> bool
- _sandbox_mode · function · L157-L163 — def _sandbox_mode(value: str | None) -> str
- _canonical_dir · function · L166-L174 — def _canonical_dir(path: str | os.PathLike[str]) -> Path
- _seatbelt_string · function · L177-L190 — def _seatbelt_string(value: str | os.PathLike[str]) -> str
- _workspace_isolation_paths · function · L193-L273 — def _workspace_isolation_paths( workspace: str | os.PathLike[str], read_isolation: KernelReadIsolation | None, ) -> tuple[Path, tuple[Path, ...], tuple[Path, ...]] | None
- _seatbelt_workspace_read_rules · function · L276-L320 — def _seatbelt_workspace_read_rules( workspace: str | os.PathLike[str], read_isolation: KernelReadIsolation | None, ) -> list[str]
- _instance_secret_entries · function · L326-L365 — def _instance_secret_entries(data_dir: Path) -> list[tuple[str, str]]
- _default_secret_read_denials · function · L368-L438 — def _default_secret_read_denials( workspace: str | os.PathLike[str], ) -> tuple[tuple[str, str], ...]
- build_seatbelt_profile · function · L441-L488 — def build_seatbelt_profile( workspace: str | os.PathLike[str], temp_dir: str | os.PathLike[str], *, allow_raw_network: bool = False, deny_read: Sequence[tuple[str, str]] = (), read_isolation: KernelReadIsolation | None = None, ) -> str
- wrap_seatbelt_command · function · L563-L580 — def wrap_seatbelt_command( command: Sequence[str], *, executable: str, workspace: str | os.PathLike[str], temp_dir: str | os.PathLike[str], allow_raw_network: bool = False, deny_read: Sequence[tuple[str, str]] = (), read_isolation: KernelReadIsolation | None = None, ) -> list[str]
- _bwrap_read_masks · function · L583-L606 — def _bwrap_read_masks(deny_read: Sequence[tuple[str, str]]) -> list[str]
- _bwrap_daemon_environ_mask · function · L609-L629 — def _bwrap_daemon_environ_mask() -> list[str]
- wrap_bwrap_command · function · L632-L727 — def wrap_bwrap_command( command: Sequence[str], *, executable: str, workspace: str | os.PathLike[str], temp_dir: str | os.PathLike[str], allow_raw_network: bool = False, deny_read: Sequence[tuple[str, str]] = (), read_isolation: KernelReadIsolation | None = None, info_fd: int | None = None, seccomp_fd: int | None = None, new_session: bool = True, ) -> list[str]
- _default_runner · function · L852-L853 — def _default_runner(command: Sequence[str], **kwargs: Any) -> Any
- _warn_once · function · L862-L867 — def _warn_once(message: str) -> None
- _bounded_diagnostic · function · L870-L874 — def _bounded_diagnostic(value: object, limit: int = 600) -> str
- _globally_unavailable · function · L877-L895 — def _globally_unavailable(detail: str) -> bool
- _detect_backend · function · L898-L911 — def _detect_backend( *, platform_name: str, which: Which ) -> tuple[str | None, str | None, str]
- _allocate_outside_probe · function · L914-L940 — def _allocate_outside_probe(workspace: Path, temp_dir: Path) -> Path
- _allow_read_probe · function · L943-L982 — def _allow_read_probe(root: Path, token: str) -> tuple[Path, bool]
- _assert_no_external_workspace_hardlinks · function · L985-L1055 — def _assert_no_external_workspace_hardlinks(workspace: Path) -> None
- KernelSandbox · class · L1058-L1730 — class KernelSandbox
- init · method · L1061-L1106 — def init( self, *, status: SandboxStatus, executable: str | None = None, temp_dir: str | None = None, allow_raw_network: bool = False, owns_temp_dir: bool = False, deny_read: Sequence[tuple[str, str]] = (), read_isolation: KernelReadIsolation | None = None, ) -> None
- wrap_command · method · L1108-L1180 — def wrap_command(self, command: Sequence[str]) -> list[str]
- popen_pass_fds · method · L1182-L1192 — def popen_pass_fds(self) -> tuple[int, ...]
- _read_bwrap_info · method · L1194-L1237 — def _read_bwrap_info(self, descriptor: int) -> Mapping[str, Any]
- _read_bounded_proc_file · method · L1240-L1265 — def _read_bounded_proc_file(path: Path) -> str
- _proc_parent_pid · method · L1268-L1296 — def _proc_parent_pid( cls, process_pid: int, *, proc_root: str | os.PathLike[str], ) -> int
- _proc_direct_children · method · L1299-L1322 — def _proc_direct_children( cls, process_pid: int, *, proc_root: str | os.PathLike[str], ) -> tuple[int, ...]
- _assert_pidfd_alive · method · L1325-L1336 — def _assert_pidfd_alive( pidfd: int, *, pidfd_send_signal: Callable[..., Any], identity: str, ) -> None
- adopt_process · method · L1338-L1513 — def adopt_process( self, launcher_pid: int, *, proc_root: str | os.PathLike[str] = "/proc", ) -> None
- _reset_bwrap_process_identity · method · L1515-L1534 — def _reset_bwrap_process_identity(self) -> None
- apply_environment · method · L1536-L1543 — def apply_environment(self, environment: Mapping[str, str]) -> dict[str, str]
- interrupt_target_pid · method · L1545-L1596 — def interrupt_target_pid( self, launcher_pid: int, *, proc_root: str | os.PathLike[str] = "/proc", ) -> int
- send_interrupt · method · L1598-L1690 — def send_interrupt( self, launcher_pid: int, signum: int, *, proc_root: str | os.PathLike[str] = "/proc", ) -> bool
- _report_interrupt_gap · method · L1692-L1712 — def _report_interrupt_gap(self, reason: str) -> None
- take_interrupt_gap · method · L1714-L1722 — def take_interrupt_gap(self) -> str | None
- close · method · L1724-L1730 — def close(self) -> None
- _run_self_test · function · L1733-L1913 — def _run_self_test( *, backend: str, executable: str, workspace: Path, temp_dir: Path, allow_raw_network: bool, runner: Runner, deny_read: Sequence[tuple[str, str]] = (), read_isolation: KernelReadIsolation | None = None, ) -> tuple[bool, str]
- _degraded_status · function · L1916-L1931 — def _degraded_status( *, mode: str, workspace: Path, backend: str | None, detail: str ) -> SandboxStatus
- create_kernel_sandbox · function · L1934-L2158 — def create_kernel_sandbox( workspace: str | os.PathLike[str] | None = None, *, mode: str | None = None, allow_raw_network: bool | None = None, read_isolation: KernelReadIsolation | None = None, platform_name: str | None = None, which: Which = shutil.which, runner: Runner = _default_runner, ) -> KernelSandbox