Restrict macOS runtime to trusted CI runs - #251
Closed
sunxiaoguang wants to merge 2 commits into
Closed
Conversation
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.
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.
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
runtime-macosjob runs on a persistent self-hosted macOS runner andpreviously accepted
pull_requestevents. That allowed PR-controlledMakefile and test scripts to execute on the persistent host and influence the
shared fixture cache.
This change:
runtime-macosto pushes targetingmainandworkflow_dispatchruns targetingmain;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.github/workflows/main.ymlCloses #250
Summary by cubic
Restricts the self-hosted macOS runtime to trusted runs on
mainand 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-macosruns only onpush/workflow_dispatchtorefs/heads/main; removes PR-only permissions/guards and sets non-cancelling concurrency for main.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.