Skip to content

feat: lock down actions settings in apply-preferred-settings - #72

Merged
scode merged 1 commit into
mainfrom
feat/repo-actions-lockdown
Aug 25, 2026
Merged

feat: lock down actions settings in apply-preferred-settings#72
scode merged 1 commit into
mainfrom
feat/repo-actions-lockdown

Conversation

@scode

@scode scode commented Aug 25, 2026

Copy link
Copy Markdown
Owner

CI on these repos runs on paid, self-hosted-style runners. A public
repo accepts pull requests from any fork, and by default a fork PR's
workflow runs on the base repo's runners as soon as that account has
one merged PR — so anyone patient enough can run arbitrary code on
runners billed to me. Requiring approval for every external
contributor closes that; a read-only default token limits what an
approved run that turns out to be malicious can still do. Neither is
a hard ceiling (pull_request_target is never gated, and a workflow can
raise its own token permissions), which the docs now say plainly.

GitHub keeps two separate switches for this depending on visibility:
the approval policy exists only on public repos, and non-public repos
have their own fork-workflow controls instead. Rather than treating
the inapplicable one as drift, each repo gets whichever applies, and
for non-public repos the strictest option is taken: fork PR workflows
don't run at all.

Writes are now planned per endpoint from what actually drifted, so a
setting an organization has locked can't block the ones that matter.
The first_time_contributors variants are not accepted as
already-correct even though GitHub offers them — they are the very
defaults that let a once-merged account run workflows unattended.

@scode
scode force-pushed the feat/repo-actions-lockdown branch from dc19bab to 60946f7 Compare August 25, 2026 03:16
CI on these repos runs on paid, self-hosted-style runners. A public
repo accepts pull requests from any fork, and by default a fork PR's
workflow runs on the base repo's runners as soon as that account has
one merged PR — so anyone patient enough can run arbitrary code on
runners billed to me. Requiring approval for every external
contributor closes that; a read-only default token limits what an
approved run that turns out to be malicious can still do. Neither is
a hard ceiling (pull_request_target is never gated, and a workflow can
raise its own token permissions), which the docs now say plainly.

GitHub keeps two separate switches for this depending on visibility:
the approval policy exists only on public repos, and non-public repos
have their own fork-workflow controls instead. Rather than treating
the inapplicable one as drift, each repo gets whichever applies, and
for non-public repos the strictest option is taken: fork PR workflows
don't run at all.

Writes are now planned per endpoint from what actually drifted, so a
setting an organization has locked can't block the ones that matter.
The `first_time_contributors` variants are not accepted as
already-correct even though GitHub offers them — they are the very
defaults that let a once-merged account run workflows unattended.
@scode
scode force-pushed the feat/repo-actions-lockdown branch from 60946f7 to b9af0da Compare August 25, 2026 03:57
@scode
scode merged commit 72bf3a8 into main Aug 25, 2026
6 checks passed
@scode
scode deleted the feat/repo-actions-lockdown branch August 25, 2026 04:14
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