Repository navigation
Harden the tool gate, trust and MCP; turn the bash sandbox on by default - #22
Merged
Merged
Conversation
… gate Fixes from three audit rounds, each with a test that fails without it: - Tool gate: an approved escape no longer leads to a protected target, an extra tool cannot reuse a built-in name, session approvals cover every argument of non-file tools, the checked path is the one the tools touch, cached approvals no longer reset the doom-loop counter, deleting a directory keeps protected files, and a bash command with a NUL byte is refused (it let an ordinary approval spell the escape's key). - Protected paths: more credential files (git, gh, cargo, maven, gradle, Hugging Face, uv, terraform, vault, rclone, keyrings, npmrc, SSH keys by name, tfstate), .git/config and .git/hooks, /proc and /sys; names are matched the way macOS and Windows open them (case folding, trailing dots, 8.3 short names); hard links to credential files are refused. - bash environment: credentials are also recognised by their value (provider key formats, a password in a URL or DSN), whatever the name. - Undo refuses a file that a symlink now points elsewhere. - Sandbox: on by default where the OS can enforce it (Landlock on Linux, Seatbelt on macOS, modelled on Codex's profile), with a private temp dir and a private build cache; only the toolchain parts of the home directory are readable; DNS opens with any TCP port (Landlock v10 filters UDP); what a confined command leaves for git to run is put back; a command may run outside the sandbox only after the user approves that exact command.
- A discovered config whose real file is outside its directory is refused (a symlink borrowed another project's trust or overwrote the global config), and the global config is never rewritten as a project config. - rules, a budget above the defaults, and a provider or model other than the user's own now need `ouija trust`; `ouija trust` shows them and the sandbox paths and network a config opens. - Without an absolute config directory there is no global config: it used to be a relative path a cloned repository could ship. - Chat saves keep the project's own sandbox section, not the merged one. - The global sandbox setting can turn the default sandbox off, and a project may forbid the unsandboxed escape but never allow it over the global; doctor reports the default sandbox.
…urces/read Messages over 4 MiB get a parse error and the stream continues; at most 8 calls run at once; a request reusing a running id is refused (ids compared by exact value); resources/read requires the ouija://project/ scheme, serves nothing when the root is /, the home folder or above it, reports relative paths only and stays silent once cancelled; the install backup no longer follows a planted symlink.
…cters The folder is written into the shell rc file: a relative one put the current directory on PATH, and $, backticks, quotes or backslashes ran as code in every new shell. install.ps1 requires an absolute -InstallDir too.
Security, config schema, configure, CLI, environment and MCP pages, the README and the site now cover the bash sandbox on by default (and what it reads, writes and leaves out), the approved unsandboxed escape, the new trust-only keys, the protected paths and the MCP server's limits.
First CI run on those systems: macOS now refuses to run open, osascript and osacompile at all (osascript ran a local script), and on Windows the config directory is normalized like the checked path, so an 8.3 short name in it (C:\Users\RUNNER~1) no longer hides ouija's global config from the protected-path check. The tests now expect macOS's cache dir and its stricter git rules.
Every free model in the list was gone from OpenRouter; the list now has current ones with tool support, led by openrouter/free, which routes to whatever free model is up. The docs' examples use openrouter/free so they stop going stale.
…ocumented internal/doccheck already checked the links; it now also walks the config structs' JSON keys, the CLI's command table with the registered totems, and every OUIJA_* variable the code reads, and requires each in docs/reference. A new one can no longer ship without its docs.
A page-by-page audit against the code: the trust-only keys, the full protected-path list, a safe sandbox example (the old one made the real Go cache writable), the private temp and cache, the git restore, the order of checks with the NUL refusal and the unsandboxed step, the built-in tools and their parameters, MCP limits, the env filter, the doctor checks, exit output order, the totems in the CLI reference and on the site, the installers' options and the dependencies. Claims the code did not back (a provider fallback) are gone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three security audit rounds over the tool gate, project trust, the MCP server and the installers, plus a sandbox redesign based on what Codex, Claude Code (sandbox-runtime), Cursor and Gemini CLI do. Every fix has a test that fails without it.
Bash sandbox, now on by default where the OS can enforce it (Landlock on Linux, Seatbelt on macOS):
core.fsmonitor,!aliases, filters…) is put back after it;open,osascript), no Docker socket, no other terminals' ttys,.githooks/config read-only and.gitnot movable;"unsandboxed": true); never without an approval UI, andallowUnsandboxed: falseremoves it.Tool gate and protected paths: approved escapes, shadowed built-in names, approval keys, path checks, doom-loop resets, directory deletes, NUL bytes; more credential files, platform name folding (case, trailing dots, 8.3 names), hard links; credentials in env values.
Trust and config: symlinked configs from outside the project,
rules, raised budgets and provider/model switches needouija trust; no relative global config; chat saves keep the project's own sandbox.MCP: bounded messages, at most 8 concurrent calls, duplicate ids refused, stricter
resources/read.Installers: absolute install dir without shell metacharacters.
Not covered yet, and documented: network allowlisting by domain (it is by TCP port), and on Linux
.gitstays writable during a command (put back after it). The macOS and Windows parts are verified by this PR's CI only.