Repository navigation
fix: harden the sandbox, git restore, file tools and project trust - #29
Merged
Merged
Conversation
…pprovals Open, write and delete through an os.Root on the project and check the opened file again, so a symlink swapped in after the check is not followed. Refuse FIFOs, hard links to protected files, writes to .git metadata and paths with control or invisible characters. Key approvals on the physical path and show it, symlink target included. Bound line reads, glob ** patterns and edit_file sizes, and protect common project secret files.
… the git restore A seccomp filter lets sockets make only TCP and UDP (MPTCP, SCTP, ICMP, raw and packet refused, UDP too with no port open), refuses io_uring and reading other processes. Each command runs in its own user and PID namespace, with a process group as the fallback, so nothing it starts outlives it. The git restore now covers config.worktree, commondir, submodules, worktrees, a core.hooksPath, hook-manager configs, included configs and nested repositories, with a parser checked against git.
A key set twice could show the review one value and apply another. ouija trust now shows every effect in full, reveals invisible characters, and asks before it records the trust. Untrusted files cannot set totem dimensions, model suggestions, more passes, a longer stream timeout or a larger context. Discovery skips configs other users own and stops at the home directory.
… private The approval prompt names the file that will be written, uncut. The editor flow writes through the sandbox, picker items are cleaned, and the debug log moves to the user cache directory with mode 0600.
A redirect to another host would carry x-api-key along. Bodies, stream lines, whole replies and model-list pages are capped. Trace files are written 0600.
Started from / or the home directory, a totem could read the whole home. Tool calls are refused there too, also when HOME is unset.
The doc HTML declares UTF-8 first and drops other charset declarations, control bytes and favicon links, so a charset trick cannot hide a meta refresh. review overrides every configured filter driver, which git ran outside the sandbox. task and sticker write through SafeWriteFile.
Verify the attestation against the release workflow on refs/heads/main, say when only the checksum was checked, and install the latest stable release unless asked for a pre-release. The Windows installer asks before it changes PATH.
make check ran in the job holding id-token and contents write. A private repository now warns that provenance is not signed.
Describe the seccomp filter, PID namespaces, the wider git restore, os.Root opens, the approval target, trust review changes, provider caps and the installer provenance checks, and fix pages that had drifted from the code.
…e restore Issue #24 reported the restore deleting directories inside .git/hooks. The test fails on the code before this branch and passes now.
The seccomp filter refuses UDP with no port open, so only a sandbox with an open port sends UDP on ABI v9.
7 tasks
Tag characters (U+E0000–E007F) and the other format characters are invisible in the approval prompt but read by the model; they are refused before any prompt, like the bidi and zero-width ones.
A non-blocking write open of a FIFO with no reader fails with ENXIO, which macOS words differently from Linux; it is now refused as a file that is not regular.
On macOS /home is a link to /System/Volumes/Data/home, which looked deep enough once resolved when no home folder is known.
staticcheck ST1018 flags format characters written literally in string and rune literals.
A review of every page against the code found stale check orders, approval options, file locations, limits and environment variables, an example that did not compile, and a missing OUIJA_SANDBOX_POLICY entry.
Discovery compared paths as text, so a Windows short name (RUNNER~1) or a symlinked home walked past the home directory. Directories are now compared as files.
The restore removed the hooks directory git init had just made, and a confined git init raised two notices. A new directory runs nothing, and a confined command's ordinary git changes no longer raise the git guard notice (the restore already put back what runs).
With no port open, npm view spent 70 seconds retrying a registry it could never reach before it failed. npm_config_fetch_retries=0 and PIP_RETRIES=0 make it fail at once; a value the user set is kept.
A read of a missing file showed as a success in the trace.
An absolute path was joined onto the root: reading the project's own file by it found nothing, and writing it created a stray <root>/home/... tree while reporting the absolute path. Inside the project it now names the file; outside it is refused like ../ with a hint to use a relative path.
… image alike The install command and its GIF sat below the explanation and the diagram; they now follow the demo, and the explanation moves under its own heading. Every screenshot and GIF is centred at 800 pixels, in the README and in the install guide.
The demo had no window frame while the install GIF had one; both now share the title bar, dots and border. Frames and timing are unchanged.
The four README screenshots were captured by hand: each had its own size, one an empty band, and one showed a task dimension that does not exist. make screens renders them from the chat model at one terminal size, in the install GIF's window frame, and captures them with headless Chrome, so they match each other and the current version.
… bar The images now bring their own window frame; the site's wrapper drew a second one.
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.
Hardens the bash sandbox, the git restore, the file tools, project trust, the providers, the MCP server, the totems and the installers. Every fix comes with a test that fails without it; the suite passes on Linux, and
go vetpasses for Linux, macOS, Windows and arm64. Each commit builds and passes the tests on its own.Fixes #24.
Bash sandbox (Linux)
socket()make only TCP and UDP over IPv4/IPv6, Unix, netlink andAF_ALGsockets. MPTCP, which Landlock's TCP rules do not cover, reached a server on the internet from a closed sandbox; it now fails withEPROTONOSUPPORT(programs fall back to TCP). SCTP, ICMP, raw and packet sockets are refused, UDP too when no port is open (Landlock ABI v9 does not filter it), and so areio_uring_setup, netlinksock_diag,ptrace,process_vm_readv/writevandpidfd_getfd. An architecture the filter does not know counts as no sandbox.setsidincluded; the process group is the fallback where user namespaces are forbidden.ouija doctorshows which.Git restore (#24)
config.worktree,commondir,info/attributes, submodules, linked worktrees,.gitswapped for a pointer, an existingcore.hooksPath(husky), hook-manager configs (pre-commit, lefthook), work-tree files the config includes, nested repositories (depth 8, plusnode_modules/<pkg>), and repositories the command creates.git config --liston generated files; an unreadable config is put back whole..git/hooksare no longer deleted.File tools and approvals
os.Rootand the opened file is checked again, so a symlink swapped in after the check is not followed. FIFOs, hard links to protected files and writes to.gitmetadata are refused.app/etc/env.php,auth.json,wp-config.php,*.pem,*.key,terraform.tfvars, …), with case folding on every OS.**patterns andedit_filesizes are bounded.Config and trust
ouija trustshows every effect in full, reveals invisible characters, and asks before recording the trust (--yesfor scripts). Untrusted files cannot set totem dimensions, model suggestions, more passes, a longer stream timeout or a larger context. Discovery skips configs other users own and stops at the home directory.Providers, MCP, totems, installers
x-api-key); bodies, stream lines, whole replies and model-list pages are capped. Debug logs and traces are written0600./or the home directory, also whenHOMEis unset.docpins UTF-8 and strips charset declarations, control bytes and favicon links (a charset trick could hide a meta refresh);reviewneutralises git filter drivers, which ran outside the sandbox.refs/heads/main, install stable releases by default, and the Windows one asks before changingPATH. The release checks run in a job without write access.Docs
Every page was checked against the code and updated.
Not covered
install.ps1was not run (pwshunavailable);install.shpassedsh -n.Makefile,package.json) are writable and run later outside the sandbox; repositories nested deeper than 8 directories are not checked.