Skip to content

Untrusted pull requests

manni docevals runs code that content files ask it to run. On a pull request from a fork, the person supplying those content files is a stranger.

Read this before enabling the gate on a public repository.

One path from a content file to code on your runner

Section titled “One path from a content file to code on your runner”

A page can declare a command eval in its frontmatter:

evals:
- id: check
grader: command
command: [node, scripts/whatever.mjs, "{file}"]

That command runs by default. The frontmatter-commands grant is on unless execution.allow in the config leaves it out. On a fork’s pull request, the fork wrote the page, so a default run executes the fork’s code on your runner.

--no-execution is the step that stops it. Every job that reads a fork’s pages passes it:

Terminal window
manni docevals run --since origin/main --no-execution

With it, every page-declared command eval reports as skipped with a reason, never as a pass. Writing execution: { allow: [] } in the config does the same for every run, but a fork can edit the config too. The flag lives in your workflow.

A command eval defined in manni.config.yaml is not gated, because the config is the operator’s own code. On a pull request, though, the config is part of the change too, and --no-execution does not stop it.

A flag is not sufficient on its own. Restrict the job that can execute content-driven code to same-repo pull requests:

jobs:
verify-docs:
runs-on: ubuntu-latest
# SECURITY GATE. Do not remove.
if: >-
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository
steps:
- uses: actions/checkout@v7
# ... full run, with secrets available

Then give forks a separate job that runs no page-declared command and needs no secret:

verify-docs-fork:
runs-on: ubuntu-latest
if: >-
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with: { node-version: 24, cache: npm }
- run: npm ci
- run: npx @hawkeyexl/manni docevals run --deterministic-only --no-execution --format github

Fork contributors still get every tool:regex check with no credential in reach. --no-execution is the required part of that command. Leave it out and the fork’s page-declared commands run on the fork job. A command eval in the fork’s manni.config.yaml still runs there, as anything in the fork’s workflow would. That job holds no secret and gets a read-only token, so it has nothing worth stealing.

Frontmatter and structure are checked by their own domains. Add manni meta validate and manni lint structure as steps in the same job. Neither runs content-authored code.

It runs with repository secrets and can be made to check out the fork’s code. That combination is how tokens leak. If you are reaching for it to give forks a full run, stop: the deterministic job above is the safe version of what you want.

Secrets are unavailable on forks by design

Section titled “Secrets are unavailable on forks by design”

GitHub does not expose secrets to fork pull requests. That is a feature. It also means the fork path must work without a provider, which --deterministic-only does.

If your gate is unusable without a key, fork contributors get no signal at all, and you will be tempted toward the unsafe workaround above.

  • The job that can execute content code is gated to same-repo pull requests.
  • Forks run a separate --deterministic-only --no-execution job with no secrets.
  • Every job that reads a fork’s pages passes --no-execution. That is defence in depth, not the defence.
  • execution.allow lists only the grants the corpus needs, if it needs fewer than all of them.
  • Third-party actions pinned to a full commit SHA, not a tag.
  • permissions: set to least privilege (contents: read for a check job).
  • A turn budget set (judge.maxTurns), so a malicious or accidental change cannot run up a bill.

A pull request that edits the workflow is asking for a change to what runs with your credentials. Review those with the same care as a change to authentication code. Remember too that a contributor who can add a command eval to manni.config.yaml has changed what the whole job runs. That holds even if the workflow file is untouched.