Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ All code authored in or evaluated by DevOps CLI must strictly adhere to the foll
6. **Host Sandbox Confinement**: Executable verification criteria and model-generated shell commands are confined within Linux unprivileged namespaces via `bubblewrap` (`bwrap`), enforcing unshared namespaces, cleared environment, read-only repository and system mounts, zero network egress, and isolated POSIX process groups. The host sandbox's `/tmp` is a private 64 MiB tmpfs mounted nosuid and nodev, which the confined command can write to and execute from, because bubblewrap has no noexec option for a tmpfs.
7. **Review Tool Execution**: A review starts its tools through a `ToolExecutor` (`src/devops_cli/security/tool_executor.py`). The tools are Bandit, Gitleaks, Semgrep, Trivy, kube-linter, Pluto, osv-scanner, golangci-lint, Ruff, mypy and the canary of each. The record of each run names the executor in force. It is the `executor` field in `tool_runs` of `profile.json`, and the Executor column of the Tool Runs table in `review.md`. The record also names the network of the tool in the `network` field: `host` for the direct executor, `none` for the sandbox, and `kube-api` for the sandbox with that network profile. Two executors exist:
- `sandbox` is `SandboxToolExecutor`, and it is the default of `devops review path`, `branch` and `pr` and of their MCP tools. It runs the tool in a `bubblewrap` sandbox with no network, a cleared environment, a read-only tree and a private HOME. The sandbox shows the system directories, the tree and only what the request names: the program of the tool (its virtualenv, with the Python installation that the virtualenv links to, behind the guard of `HostSandbox`), its config and ruleset files, the data that a fetch step got before (the Trivy cache and the osv-scanner database, read-only; `devops review fetch-databases` is that step, and a scan that lacks a database, or finds the osv-scanner database older than 24 hours, gives a coverage gap that names it) and the host paths in `CONST_TOOL_HOST_READ_ONLY_PATHS` (the CA certificates for Semgrep). golangci-lint also gets the Go toolchain and the module cache that `go env` names on the host, read-only, with the `bin` of the toolchain first on its `PATH`. Its `go` command fetches no module and no toolchain (`GOPROXY=off`, `GOTOOLCHAIN=local`), so a module whose modules are not in the module cache gives a coverage gap that tells the person to run `go mod download`. A directory that the tool writes, the cache of mypy or of Ruff, or the Go build cache and the golangci-lint cache, for the tree, is bound read-write. The sandbox refuses a bind that holds the home directory or the tree, or passes through a credential directory. Each process of the tool has the CPU limit `CONST_TOOL_CPU_LIMIT_SECONDS` and the address-space limit `CONST_TOOL_MIN_ADDRESS_SPACE_BYTES`. Gitleaks and Semgrep get the larger value that `CONST_TOOL_ADDRESS_SPACE_BYTES` names, and Semgrep runs `CONST_SEMGREP_JOBS` jobs. A Go tool gets `GOMEMLIMIT` set to `CONST_TOOL_GO_MEMORY_LIMIT`. The wall-clock limit applies as well. The sandbox sets no limit on the number of processes, because `RLIMIT_NPROC` counts every process of the user and would starve the host.
- `direct` is `DirectToolExecutor`. It starts the tool as a child process of devops-cli. It has no confinement: the tool has the network, the environment and the files of the user. It has no limit except the wall-clock time of the scan, `DEFAULT_SECURITY_SCANNER_TIMEOUT_SECONDS`. A review never uses it: no option, config key or MCP tool turns the sandbox off (decision 1 of #772). The scans of `devops scan` and of the agent tools are not reviews, and each scanner except Popeye uses this executor there.
- `direct` is `DirectToolExecutor`. It starts the tool as a child process of devops-cli. It has no confinement: the tool has the network, the environment and the files of the user. It has no limit except the wall-clock time of the scan, `DEFAULT_SECURITY_SCANNER_TIMEOUT_SECONDS`. A review uses it only in the pod of a runner Job, where the seccomp profile refuses the user namespace that the sandbox needs and the pod is the isolation boundary (ADR 0031, #3827). There a scanner that the image lacks fails the review (`ReviewScannerMissingError`). Everywhere else no option, config key or MCP tool turns the sandbox off (decision 1 of #772). The scans of `devops scan` and of the agent tools are not reviews, and each scanner except Popeye uses this executor there.
- The sandbox has one network profile, `kube-api`, and only Popeye can select it (decision 2 of #772). `devops k8s audit`, the agent tool `scan_popeye` and the scanner registry run Popeye in the sandbox with this profile, from an empty directory. The sandbox keeps no network of its own (`--unshare-all`). Outside the sandbox, `kubectl proxy` listens on a Unix socket in a scratch directory for one context. It reads the kubeconfig and the credentials of the user, and refuses the methods POST, PUT, PATCH and DELETE (`CONST_KUBE_API_REJECTED_METHODS`) and the exec, attach, port-forward and proxy paths (`CONST_KUBE_API_REJECTED_PATHS`). `setpriv --pdeathsig KILL` ends the proxy with the run. In the sandbox, `socat` relays `127.0.0.1:8001` to the socket, and Popeye reads a kubeconfig that names the relay and holds no credentials. The sandbox binds the scratch directory and `/etc/passwd` read-only. So Popeye reaches only the API server of the context, only to read, with the RBAC of the user. The limits: the path filter is a deny list, so a new subresource that reaches past the API server passes until `CONST_KUBE_API_REJECTED_PATHS` lists it, and Popeye reads each response that the user can read, such as a Secret. The direct executor refuses a request that selects the profile. A host without `sh`, `socat`, `kubectl` or `setpriv`, or one that cannot start the sandbox, runs no Popeye scan: the scan reports a coverage gap with the cause, and `devops k8s audit` exits 1.

Before its first tool runs, a review checks that the host can start the sandbox: bubblewrap and `prlimit` are installed, and bubblewrap can make a sandbox. On Ubuntu 24.04 and later, AppArmor refuses unprivileged user namespaces to a program that has no profile with the `userns` rule (`kernel.apparmor_restrict_unprivileged_userns`). A host that fails the check fails closed: no tool runs, in the sandbox or outside it, each scan reports a coverage gap with the cause, and the review says the cause and what a person can change on the host one time. The record is read before the tool starts. Under the `direct` executor, a tool that fetches its rules during the run, such as Trivy with an old cache, may use newer rules than the record names, and Ruff also applies a config file above the tree and its user config file, which the record does not name.
Expand Down
Loading