Skip to content

fix(#42): verify the emulator's certificate in Compose and Vagrant - #136

Open
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/42-verify-runner-tls
Open

fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/42-verify-runner-tls

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

The Compose and Vagrant Python runners now verify the emulator's TLS certificate by default. Both used to ship RUNNER_TLS_VERIFY=false.

Compose (docker-compose.yml, supervisord.conf, scripts/export-caddy-root-ca.sh)

  • actions-runner now connects to https://ghemu.local. ghemu.local is a new network alias of github-emulator and the name Caddy's certificate carries. Since Compose actions-runner cannot register: Caddy has no certificate for github-emulator #81 the runner had used plain http://github-emulator:8000.
  • A new supervisord program, scripts/export-caddy-root-ca.sh, waits for Caddy's local CA and copies only root.crt (not root.key) to $CADDY_ROOT_CA_EXPORT. If the variable is unset it does nothing, so other deployments of the image are unaffected. Compose sets it to a path on the shared caddy_root_ca volume.
  • The runner's entrypoint waits for that file, adds it to the OS bundle with update-ca-certificates, then starts runner.py. SSL_CERT_FILE points at the OS bundle, which keeps the public roots. git in checkout steps uses the same bundle, and so do gh/curl in job steps.
  • A new caddy_data volume keeps Caddy's CA when the emulator container is recreated (for example by docker compose up -d --build). Otherwise a running runner would be left trusting the old CA. make up still wipes volumes, so the runner it recreates picks up the new CA.

Vagrant (Vagrantfile, Makefile)

  • The runner VM now defaults to https://ghemu.local, which its /etc/hosts already maps to the server VM.
  • The old "trust the emulator's cert" step has been removed. It ran openssl s_client against the IP without SNI and saved the leaf certificate, and it ran before the emulator was deployed, so it never worked. It is replaced by a ghemu-ca shell provisioner, which installs .vagrant/ghemu-root-ca.crt into the OS store and restarts actions-runner.
  • New make vm-runner-ca target, also run at the end of vm-deploy. It reads root.crt from the server VM's emulator container and runs vagrant provision runner --provision-with ghemu-ca.

RUNNER_TLS_VERIFY now defaults to true in both setups and can still be overridden from the environment.

Docs: docs/guides/actions-runners.md and docs/guides/api-usage.md are updated, and the ledger notes are in docs/tasks/pending/actions-runner-compose-bootstrap.md and docs/bugs/fixed/python-runner-skips-tls-verification.md.

Testing

  • New tests/test_runner_tls_deployments.py has 7 tests. They statically check the Compose and Vagrant wiring (URL, verify default, alias, shared volume, entrypoint, supervisord program, and that the Makefile and Vagrantfile agree on the CA path). They also run the export script against a fake Caddy data directory and confirm only root.crt is copied, with mode 644. On the old configuration, 5 of the 7 fail.
  • tests/test_compose_runner_urls.py and tests/actions/test_runner_tls_verify.py pass.
  • The full suite passes except two failures that also happen without this change: test_runner_shutdown::test_a_shutdown_signal_fails_the_running_step_and_stops_its_processes fails on unmodified main too, and test_security_headers fails because the frontend dist isn't built in the sandbox.
  • pre-commit couldn't fetch its hook repos (TLS error). Its hooks were run directly at their pinned versions (pre-commit-hooks 6.0.0, ruff 0.17.3, shellcheck 0.11.0.1) and passed. gitleaks ran via scan-secrets.

Caveats: manual verification needed

The issue asks for a job to run end to end in each setup. That has not been done here. The sandbox has no Docker, Podman, Vagrant, Ruby or outbound network, so the Vagrantfile's Ruby was not parsed and neither stack was started. Before merging, please check:

  1. Compose: make up, then make actions-runner-env, then docker compose up -d actions-runner. Check the runner registers with no TLS errors, then push the hello workflow from the guide and confirm it succeeds, including a checkout step.
  2. Vagrant: make vm-up then make vm-deploy (which now ends with vm-runner-ca). Check journalctl -u actions-runner on the runner VM shows a successful registration and a job.

Other notes:

  • After make vm-start on its own, run make vm-runner-ca again: vm-start wipes volumes, so Caddy creates a new CA.
  • With RUNNER_TYPE=real in Vagrant, the CA is installed but the upstream runner's systemd service isn't restarted.

🤖 Generated with Claude Code


Closes #42

Post-script verification

  • Branch is not main/master (agent/42-verify-runner-tls)
  • Secret scan passed (gitleaks — 0454bace16539f60483343fc2079d8b7d7a6ebc7..HEAD)
  • PR body secret scan passed (gitleaks — no-git)
  • Final PR description secret scan passed (gitleaks — no-git)

The shipped runners still set RUNNER_TLS_VERIFY=false because neither
could verify Caddy's certificate: the addresses they used are not
names the certificate carries, and neither had Caddy's root CA.

Compose: the actions-runner uses https://ghemu.local, a network alias
of github-emulator. A new supervisord program
(scripts/export-caddy-root-ca.sh) copies Caddy's root certificate, not
its key, to the shared caddy_root_ca volume when CADDY_ROOT_CA_EXPORT
is set. The runner's entrypoint waits for it, adds it to the OS bundle
and points SSL_CERT_FILE there, so git in checkout steps trusts it too.
A caddy_data volume keeps the CA across container recreation, so an
emulator rebuild does not strand a running runner on an old CA.

Vagrant: the runner defaults to https://ghemu.local (already in its
/etc/hosts). The old s_client step fetched the leaf certificate from
the IP without SNI, before the emulator was even deployed, so it never
worked; it is replaced by a "ghemu-ca" provisioning step. New
make vm-runner-ca (run by vm-deploy) copies root.crt from the server
to .vagrant/ghemu-root-ca.crt and re-runs that step, which installs it
and restarts the runner.

RUNNER_TLS_VERIFY now defaults to true in both and can still be
overridden. Tests: tests/test_runner_tls_deployments.py checks the
wiring and runs the export script; 5 of its 7 tests fail on the old
configuration. Docs and ledger updated.

Note: not run end to end. The sandbox has no Docker, Podman, Vagrant,
Ruby or network access, so a job has not been run in either setup.
pre-commit could not fetch hook repos (TLS error); its hooks were run
directly at their pinned versions (pre-commit-hooks 6.0.0, ruff
0.17.3, shellcheck 0.11.0.1) and passed; gitleaks via scan-secrets.
Pre-existing unrelated failures: test_runner_shutdown and
test_security_headers (frontend dist not built).

Closes #42

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Triggers review agent dispatch label Dec 3, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 2:55 PM UTC · Completed 3:04 PM UTC

Commit: 238585a · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.84

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Dec 3, 2026
@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Moderate risk change that closely aligns with the linked issue and provides opt-out rollback safety via RUNNER_TLS_VERIFY, despite touching a protected script path and Makefile.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Medium

  • [protected-path] scripts/export-caddy-root-ca.sh — This PR adds a file under the protected scripts/ path. The PR links issue Verify the emulator's certificate in the Compose and Vagrant runners #42 (Closes #42) and its description explains the rationale (exporting Caddy's root CA, without its key, so the Compose runner can verify TLS). Human approval is always required for protected-path changes, regardless of context.
    Remediation: A human maintainer should review and approve the new script.

Labels: PR changes Docker Compose/container setup and updates guides.

@fullsend-ai-review fullsend-ai-review Bot added requires-manual-review Review requires human judgment docker Pull requests that update docker code documentation Improvements or additions to documentation labels Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Pull requests that update docker code documentation Improvements or additions to documentation ready-for-review Triggers review agent dispatch requires-manual-review Review requires human judgment risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verify the emulator's certificate in the Compose and Vagrant runners

1 participant