// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-FileCopyrightText: 2025 ai-ad4 and the FreePDFEditor contributors // // Sandbox.h — the seccomp-bpf filter for the sandboxed document process // (engineering plan §2.1, ADR-0004). The document process gets no network // access and no filesystem access beyond the fds handed to it by the UI // process. This is the Linux part of the sandbox; macOS (App Sandbox) and // Windows (AppContainer) land in M1. // // The filter is allow-list: default-deny, then permit the syscalls the // document process needs (memory, thread-sync, the IPC socket fds it already // holds, exit). Notably DENIED: socket, connect, open/openat, unlink, fork, // exec — the document process cannot reach the network or the filesystem, and // cannot spawn children. #ifndef FREEPDFEDITOR_SPIKE_E_SANDBOX_H #define FREEPDFEDITOR_SPIKE_E_SANDBOX_H namespace freepdfeditor::spike::e { // Install the seccomp-bpf filter in the calling process. Returns 0 on // success, a negative errno on failure. After this returns, the process can // only call the allow-listed syscalls; any other syscall kills the process // (SECCOMP_RET_KILL_PROCESS) so a sandbox escape attempt crashes loudly // rather than silently falling back. int install_sandbox(); } // namespace freepdfeditor::spike::e #endif // FREEPDFEDITOR_SPIKE_E_SANDBOX_H