Skip to content

Security: gajeshbhat/gauntlet

SECURITY.md

Security model

gauntlet assumes an agent may change anything in the repo to pass, but can't change your policy file or gauntlet itself. It makes cheating harder to get past it. It does not prove that code is correct, or replace review.

What it defends against

Trick Defence
Loosening the limits They live in your policy, outside the repo. gauntlet.toml can only be stricter. A pinned file that changes, disappears or becomes a symlink is refused.
Configuring the tools to skip code gauntlet supplies the mutmut, coverage.py and layer-check settings. The repo's settings, coverage's built-in exclusions and pragma: no cover have no effect.
Reusing old results Nothing is read from an earlier run. mutmut's cached results and timings, and old coverage data, aren't used. Changing the source during a run voids it.
Hiding code in the source Functions are found with Python's parser. no mutate comments need a budget in the policy (default 0), and block, start and end are never allowed. Source must be UTF-8, because other encodings can hide code in comments.
Using code mutmut skips A function with branches but no mutants fails, unless the policy has a budget (default 0). This includes code outside src, but not test folders (see below).
Raising the score with tests next to the code Caught bugs planted in files named like tests don't count. Missed ones do, so code can't hide there.
Counting test errors as caught bugs Each set of tests first runs twice at once, with no bug planted. If either run fails or times out, bugs tested with that set don't count as caught. Coverage is off, and mutmut's time limits are its defaults.
Moving the --changed base A name shared by two refs is refused, and replaced or grafted commits are ignored. Functions are compared by their code as well as by line.
Importing around the layers Indirect imports count, through any of the project's .py files outside its tests. Each layer must be in the project, and importing the tests is an error.
Checking nothing A run, or a scope, without both a function and a mutant exits 2. A source file missing from the coverage report counts as 0%. The report shows a missing [layers] as skipped; require_arch makes it fail.
Attacking gauntlet itself Paths and links must stay inside the project, and files have size limits. Commands are fixed. Git runs no hooks, filters or diff drivers, and never fetches missing objects. Submodules and links to folders are refused. The layer check never imports project code.

tests/test_bypasses.py runs most of these against real projects, and well-tested ones that must pass.

What it does not defend against

  • Forged results. Tests, conftest.py, pytest plugins, dependencies and build tools run alongside the tools, and can change their reports. A sandbox doesn't prevent this. Review changes to them.
  • Local Git data. --changed trusts the repo's branches, tags and stored objects. If the agent can write to .git, use a fresh checkout and a full commit ID you trust, or run the full check. It also doesn't check unchanged functions affected by a change elsewhere, such as to a constant or base class.
  • Tests that clash with other tests. A set of tests that clashes with itself usually fails the check above. Clashes between different sets, or that rarely happen, can still look like caught bugs. Tests should be safe to run in parallel.
  • Fewer tests. The repo's pytest settings still choose which tests run. Tests that fail only under mutmut are left out of mutation testing, and their names are printed. Running fewer tests should lower the score, not raise it.
  • Code in test folders, or not in .py files. No check covers the top-level test/ and tests/ folders, the top-level conftest.py, or other file types. Check that no production code was moved there.
  • A few weak tests among many good ones. The mutation score is an average, so lots of well-tested code can hide some that isn't. That includes tests next to the code that pytest only finds through a custom python_files setting. Read the list of survivors even when a run passes, and use --changed on each change.
  • Other ways to import. The layer check follows import statements from src and the project root. It can't see importlib, __import__, or folders that pytest or the code adds to the import path.
  • Weak tests in code that has a mutant. One mutant is enough to pass the unmutated-code check. mutmut skips some expressions in functions it does mutate, such as len() and isinstance() calls and complex default values. Functions without branches, and code outside functions, may not be checked.
  • Harmful code on your machine. By default, project code runs as you: it can read your files and use your network. Use OpenShell for code you don't trust. Protecting against sandbox escapes is OpenShell's job.
  • Changes to the policy or CI workflow. Keep both out of the agent's reach. On your own machine, an agent running as you can edit ~/.config/gauntlet/policy.toml; only a separate CI job or user account can prevent that.
  • Unlocked dependencies. gauntlet pins its tools, but not all of those tools' own dependencies.
  • Incomplete requirements. Good tests for the wrong behaviour still pass.
  • Files that change and change back during a run. gauntlet compares the source at the start and end of each run.

v0.2 and earlier: repo settings and source comments can bypass the checks, and check can accept results from different source. Upgrade, and don't rely on those versions as a security control.

Reporting a vulnerability

Use GitHub's private vulnerability reporting (Security tab, "Report a vulnerability"), not a public issue. Include the gauntlet version and a small example. Expect a reply within a week.

There aren't any published security advisories