Skip to content

ci(pullfrog): keep the job token off disk and the runner user untrusted by Nix - #756

Merged
kixelated merged 2 commits into
mainfrom
pullfrog/untrusted-nix
Nov 15, 2026
Merged

kixelated merged 2 commits into
mainfrom
pullfrog/untrusted-nix

Conversation

@kixelated

@kixelated kixelated commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follows up moq-dev/quest#751, which merged before CodeRabbit found the Nix installer makes the runner user a trusted daemon user (moq-dev/studio#182). Pullfrog's no_new_privs sandbox blocks sudo but not the daemon socket, and a trusted user's settings, such as a post-build-hook, run as root.

The Pullfrog setup steps now:

  • install Nix with trust-runner-user: false, so the runner user stays untrusted, and github-token: "", so the installer writes no access-tokens into /etc/nix/nix.custom.conf or /nix/receipt.json, both readable by the agent's shell;
  • fetch the flake's inputs with the job's token in the PATH step alone, through a step-scoped NIX_CONFIG;
  • fail the job if the token still reached /etc/nix or the receipt, or if nix store info reports the runner as trusted (suggested by Pullfrog in this PR).

This replaces scrubbing the token after the installer wrote it, and with it the sed over /etc/nix and the receipt chmod. The same steps go to kixel-ai/rust2#841, moq-dev/studio#182, and moq-dev/web-transport#545, byte-identical across the four. The quest's Plan is updated to match.

Caused by

Public API

None.

Validation

  • actionlint passes; the setup steps are byte-identical to the three other repositories' PRs.
  • Read the pinned installer action's source (src/index.ts at 1d87d45): getStringOrNull maps github-token: "" to null, which skips the access-tokens line, and trust-runner-user: false skips trusted-users = root <runner>.
  • NIX_CONFIG='access-tokens = github.com=abc' nix config show access-tokens prints github.com=abc.
  • The trust check against a real Nix 2.35.2 daemon: nix store info --json prints "trusted":false as an untrusted user (sudo -u nobody), which passes, and "trusted":true as a trusted one, which fails; the jq filter passes false and 0 and fails true, 1, and a missing field.
  • Not exercised on a runner: the pullfrog environment admits only main. The PATH step's grep fails the job if GitHub passed the default token instead of the empty input.
  • just check and just test pass.

Follow-ups

None.

Models

Size: XS
Implementer: Claude Code, claude-opus-5-5, unknown effort

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

Review

Rewritten by quest review after each round.

  • Head: a272645

  • Base: origin/main at 920812a

  • Risk: high, it changes .github/workflows/pullfrog.yml, which is always high: workflows run with the repository's secrets and decide what merges and ships

  • Classified: high by the always-high paths

  • Reviewer: Codex, gpt-6.1-sol, medium effort

  • Session: 01a1e084-b603-7281-84b1-888d4a8abf14, round 2

  • Score: 9/10, The added daemon-trust check fails closed and introduces no actionable defects found by code review; runtime validation was not performed as instructed.

  • Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

  • Reviewer: Codex, gpt-6.1-sol, low effort, shadow

  • Session: 01a1e084-b603-7ad2-b65a-a7a8e2f2e470

  • Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0

…ed by Nix

The installer trusted the runner user, so the agent could set daemon
options such as post-build-hook that run as root. Install with no token
and no runner trust, pass the token to the PATH step alone through
NIX_CONFIG, and fail if it still reached /etc/nix or the receipt. This
replaces scrubbing the token after the installer wrote it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 15, 2026 18:43
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The workflow now installs Nix with an empty GitHub token and disables trust for the runner user. The PATH setup step provides the token through step-scoped NIX_CONFIG for authenticated flake-input fetches. It then checks that the token is absent from /etc/nix and /nix/receipt.json, and that the daemon reports the runner user as untrusted. The Plan now describes this behavior.

Merge Risk: Minimal · up to a2726

This change keeps the GitHub job token off disk and stops the runner user from being trusted by the Nix daemon. No merge-blocking issue was found; the setup has not been run on a runner yet, so a first-run check after merge is sensible.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the Pullfrog CI job token is kept off disk and the runner user is kept untrusted by Nix. The raw summary and objectives both describe this change to .github/workflows/…
Description check Passed The description covers the change in detail. It explains the Nix installer settings (trust-runner-user: false and github-token: ""), the step-scoped NIX_CONFIG for the PATH step, the fail-closed check…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the Pullfrog CI job token is kept off disk and the runner user is kept untrusted by Nix. The raw summary and objectives both describe this change to .github/workflows/pullfrog.yml and the setup plan. The title is 78 characters, which is long but still within a single readable sentence.

Full details: Description check

Explanation

The description covers the change in detail. It explains the Nix installer settings (trust-runner-user: false and github-token: ""), the step-scoped NIX_CONFIG for the PATH step, the fail-closed checks for token leakage and daemon trust, and the removed sed and chmod steps. It also lists validation steps and links the related PRs. It is directly related to the changeset.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e2ff9cbd-8419-4257-a6b0-907aa7250ef3
Commits

Reviewing files that changed from the base of the PR and between 920812a and a272645.

Files selected for processing: 2

  • .github/workflows/pullfrog.yml
  • quest/m0/pullfrog-setup.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one suggestion inline.

Reviewed changes

I reviewed the switch from scrubbing the job token after the Nix installer writes it to never giving the installer the token, along with the new untrusted-runner setting.

  • Installer gets no token and no trust: github-token: "" keeps access-tokens out of /etc/nix and /nix/receipt.json, and trust-runner-user: false keeps the runner user out of trusted-users, which closes the path to root through the daemon.
  • Token scoped to the PATH step: flake input fetches authenticate through a step-scoped NIX_CONFIG, so later steps never see it. The fetches run in the client, so the daemon doesn't need the token.
  • Fail-closed token check: the PATH step greps /etc/nix and the receipt for the token. This replaces the sed scrub and the receipt chmod.
  • Quest plan prose: quest/m0/pullfrog-setup.md now describes the new setup.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-opus-5-5 | 𝕏

Comment thread .github/workflows/pullfrog.yml Resolved
trust-runner-user: false only stops the installer adding the runner to
trusted-users; assert the daemon really treats it as untrusted, as the
token guard does for the token, since neither runs before merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

I reviewed the one commit added since the prior Pullfrog review.

  • Runtime trust assertion: the PATH step now fails unless nix store info --json reports .trusted as false or 0, so a missing field also fails. This addresses the earlier suggestion that the trust half of the change had no fail-closed check.

Pullfrog  | View workflow run | Using claude-sonnet-5-5 | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit d0f71e1 Nov 15, 2026
15 checks passed
@kixelated
kixelated deleted the pullfrog/untrusted-nix branch November 15, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant