Skip to content

Restrict macOS runtime to trusted CI runs - #251

Open
sunxiaoguang wants to merge 2 commits into
sysprog21:mainfrom
sunxiaoguang:hardening/ci-trust-boundary
Open

Restrict macOS runtime to trusted CI runs#251
sunxiaoguang wants to merge 2 commits into
sysprog21:mainfrom
sunxiaoguang:hardening/ci-trust-boundary

Conversation

@sunxiaoguang

@sunxiaoguang sunxiaoguang commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

The runtime-macos job runs on a persistent self-hosted macOS runner and
previously accepted pull_request events. That allowed PR-controlled
Makefile and test scripts to execute on the persistent host and influence the
shared fixture cache.

This change:

  • restricts runtime-macos to pushes targeting main and
    workflow_dispatch runs targeting main;
  • limits fixture cache restore and save steps to those trusted events.

The fixture cache remains unchanged for trusted runs. Fixture lockfiles,
download validation, and SSH-key handling are intentionally out of scope.

Validation

  • git diff --check origin/main..HEAD
  • Ruby YAML parsing of .github/workflows/main.yml

Closes #250


Summary by cubic

Restricts the self-hosted macOS runtime to trusted runs on main and hardens test fixture caching. PR code can’t run on the persistent runner or read/write the fixtures cache; generated credentials are stripped before caching.

  • runtime-macos runs only on push/workflow_dispatch to refs/heads/main; removes PR-only permissions/guards and sets non-cancelling concurrency for main.
  • Fixture restore/save only on those trusted runs using actions/cache; fixtures are freshly prepared, credentials removed, and cache keys include fixture versions to avoid legacy/local state.

Written for commit 5406021. Summary will update on new commits.

Review in cubic

Prevent pull requests from executing repository-controlled commands on
the persistent self-hosted runner. Limit the runtime job and fixture
cache restore/save steps to pushes and manual dispatches targeting main,
so PR content cannot run in or write to the persistent runner.
@jserv
jserv requested a review from Max042004 July 28, 2026 16:05
cubic-dev-ai[bot]

This comment was marked as resolved.

Prevent trusted main runs from consuming fixture state left behind by
historical pull-request jobs on the persistent runner. Keep generated
test credentials out of caches that pull-request workflows can read.

Remove obsolete pull-request permissions and supersession handling from
the runtime job now that its event policy excludes those runs.
@Max042004

Copy link
Copy Markdown
Collaborator

Thank you for identifying this CI security risk.

PRs from new contributors currently require maintainer approval before CI can run, so there is no
immediate exposure. Rather than removing PR-based Hypervisor.framework testing, which provides
valuable feedback and avoids manual testing, I plan to use Github runner provided ephemeral runner:
move PR-based Hypervisor.framework testing it to a dedicated, unprivileged runner isolated from
trusted main workflows, credentials, caches, and internal resources. We can later automate system
restoration and JIT registration to provide a clean environment for every job.

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.

Validating the trust boundary of the self-hosted macOS CI runner

2 participants