Repository navigation
Conversation
… and keep privileged jobs off self-hosted labels Anyone who holds a runner registration token can register a self-hosted runner under any label. Every job of a run can write that run's artifacts with its own token, and actions/deploy-pages takes the run's github-pages artifact by name; any job of a main run can write an Actions cache that later runs restore. So the Pages run is GitHub-hosted and cacheless as a whole: - pages.yml build, current and deploy run on ubuntu-24.04; build uses setup-ci's new cache: none. - Its manual validation calls ci.yml with the new workflow_call input hosted_only: true: every ci.yml job then takes a hosted label (a prefix on its runs-on, and ci-runner-route.sh's first branch), and its caches are off (setup-ci cache: none, the hc and Playwright cache steps skipped). ci.yml's own runs and its other callers leave the input unset and run as before. - release.yml publish and shell-attach, windows-app.yml attach and mac-dmg.yml gate name ubuntu-24.04 literally; with CI_SELF_HOSTED_LABELS unset they already ran there. scripts/privileged-jobs-workflow.test.ts holds two rules to exact forms and fails closed on any other: a job with a write permission, an environment or a secret (workflow env, secrets[...] and toJSON(secrets) included) names a label from an explicit list of GitHub-hosted labels; in a run with actions/deploy-pages, every job names a listed label literally or the hosted_only prefix under a call that passes hosted_only: true literally, setup-ci's cache and cache steps' conditions are off in a reviewed form, and every action is a reviewed one at its exact reference. It reads runner labels, actions and their inputs, not shell commands or scripts. ci.yml's own runs keep their runners and caches: light-runner-workflow.test.ts pins the old expressions, conditions and modes behind the prefix and the exact places that read hosted_only; ci-runner-route.test.ts finds the route's output identical with the input unset or false. scripts/workflow-expression.ts (GitHub's expression semantics, loose equality included) serves the light-runner evaluation and has its own test.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
What
The Pages run is GitHub-hosted as a whole and restores no Actions cache, and a job that holds a write
permission, an environment or a secret never names a runner that is not GitHub-hosted.
pages.yml: build,currentand deploy run onubuntu-24.04; build installs without a cache(setup-ci's new
cache: none).pages.yml's manual validation callsci.ymlwith a newworkflow_callinput,hosted_only: true.With it, every
ci.ymljob takes a hosted label (a prefix on itsruns-on, and a first branch inscripts/ci-runner-route.sh), and its caches are off (setup-cicache: none; the hc and Playwrightcache steps skipped).
ci.yml's own runs (push, pull request, manual) and its other callers(release validation, relay deploy) leave the input unset and run exactly as before.
release.ymlpublish and shell-attach,windows-app.ymlattach andmac-dmg.ymlgate nameubuntu-24.04literally. WithCI_SELF_HOSTED_LABELSunset they already ran there; now thatvariable can never move them.
A hosted label is a boundary as observed, not as documented: a job that asks only for
ubuntu-24.04or
ubuntu-latestran on GitHub's own runners even while a self-registered runner carrying that labelwas online and idle (a trial on 2026-11-17, 14 of 14 jobs); GitHub's documentation does not state it.
pages.ymldoes not run for pull requests, so this pull request's checks do not exercise the Pagespath; it first runs on main after the merge.
The release and the other publishers (desktop, pty-sidecar, remote-bundles, windows-app, mac-dmg,
beta, relay-deploy, shell-preview) follow in a second pull request.
Why
Anyone who holds a runner registration token can register a self-hosted runner under any label, and
that runner then takes the jobs that ask for the label, with the run's token:
declares an upload step;
actions/deploy-pagestakes the run'sgithub-pagesartifact by itsname, so any job of the Pages run could supply the site it publishes, which serves the install
scripts;
that restores a cache can run code a self-registered runner planted.
Today the Pages build,
currentand deploy take the light runner expression, which a push to mainresolves to
CI_MAIN_SELF_HOSTED_LABELS(self-hosted labels), and a manual Pages run's validationruns
ci.yml's light jobs self-hosted even with every variable unset.ubuntu-24.04, no cacheci.ymlunder validateCI_SELF_HOSTED_LABELSis unset; caches restoredNothing is lost: every
ci.ymljob already runs on GitHub's runners for a fork's pull request, andthe routed ones already ran hosted in this call. Hosted runs check more, not less (the self-hosted
runner skips a few unit tests); only the runners' seeded caches go.
How it is held
scripts/privileged-jobs-workflow.test.tsparses every workflow and holds two rules to exact forms. Itfails closed on any other form, whatever that form would evaluate to:
id-token: write, an environment or a secret (from the job, itsworkflow's
env,secrets[...]ortoJSON(secrets)) names a label from an explicit list ofGitHub-hosted labels, or a matrix of them;
ubuntu-99.99and lookalikes are refused;actions/deploy-pages:uses exactly
${{ inputs.hosted_only && '<listed label>' || ... }}in a workflow whose callpasses
hosted_only: trueliterally;cache: none, or${{ inputs.hosted_only && 'none' || ... }}under such a call;actions/cacheandactions/cache/restoresteps have!inputs.hosted_onlyas a top-level&&term of their
if(a term inside an||does not count), under such a call;actions/checkout@3d3c42e...and so on;the same tag or another commit fails), and setup-ci's own steps are held the same way; its cache
steps need
inputs.cache == 'save'or'restore'as a top-level&&term of their condition, sonone of them can run under
cache: none.The test reads runner labels, actions and their inputs. It does not inspect shell commands or scripts
for cache access. Its negative cases include the forms the reviews raised: a runner hosted only in a
workflow_runevent's test context, one hosted only while a variable is set, cache steps gated on thetriggering run's conclusion, on a variable, on
failure(), on a step output, or on an input the callnever sets.
That
ci.yml's own runs are unchanged rests on two things.light-runner-workflow.test.tspins, astext, each prefixed expression's remainder to the exact expression main has (LIGHT, MAC, ROUTED,
ROUTED_FAST), each cache step's condition before
&& !inputs.hosted_onlyto main's condition, andsetup-ci's mode to main's; it also pins the exact set of places in ci.yml that read
hosted_only, so anew step gated on it fails.
ci-runner-route.test.tsruns the route for every routing it covers andfinds byte-identical output with
HOSTED_ONLYunset, empty orfalse, andubuntu-24.04withtrue. The 1,296-context evaluation in the same test, which finds each prefixed expression equal tomain's for the input unset, null or false, holds by construction (
false && x || yisy); it guardsthe evaluator and the prefix's precedence, not ci.yml's content.
release-ci-reuse.test.tsacceptsreads of
hosted_onlyonly in those exact expressions.scripts/workflow-expression.tsevaluates GitHub expressions (the subset the workflows use, withGitHub's loose equality:
null == '',null == falseare true). It is used only bylight-runner-workflow.test.ts, for the evaluation above, and by its own test; the Pages rule does notevaluate anything.
The rule rests on one observed fact, stated in the README: a job that asks only for a hosted label
(
ubuntu-24.04,ubuntu-latest) ran on GitHub's own runners even while a self-registered runnercarrying that label was online and idle; only a job that also asked for
self-hostedreached it.Observed by a trial on 2026-11-17 (14 of 14 jobs); not documented by GitHub.
Cost
ubuntu-24.04, four browser shards) took 903 s and 933 s; the installs and Chromium downloadswithout a cache add about a minute, mostly inside the longest job.
2026-11-15 to 2026-11-17), with no hosted run since at least 2026-11-10. Comparable hosted jobs
with a cold install take about 47 s, so expect 45 to 60 s, plus 1 to 3 s of hosted queue for each
of the three jobs.
pages.ymldoes not run for a pull request; the first push to main after themerge gives the measured number.
Not in this pull request
The release and the other publishers (desktop, pty-sidecar, remote-bundles, windows-app, mac-dmg,
beta, relay-deploy, shell-preview): which job builds what they publish, which artifacts they take and
how, and their caches. A second pull request takes them.
Validation
bun testof the new and touched files:privileged-jobs-workflow,workflow-expression,light-runner-workflow,release-ci-reuse,ci-runner-route,ci-setup,pages-gate,hook-kill-tests-workflow,release-validate-workflow,relay-deploy-workflow,workflow-needs,shell-deploy-workflow,shell-preview-workflow,server-binary-workflow,pr-title,ci-concurrency,ci-browser-parallel: 429 pass, 0 fail.pages.yml deploy(privilegedon the light expression) and the release-side jobs, and in the Pages run
pages.yml build,currentand
deploy, and everyci.ymljob whose runner or cache is not in a reviewed form. Mutations of thisbranch fail too: an allowed action at a tag, a step gated on
toJSON(inputs.hosted_only) == 'false',a cache condition whose
!inputs.hosted_onlysits inside an||, and a setup-ci cache step whosemode comparison sits behind an
||.bun run check faston this head: exit 0 on 288f81d (workflow syntax, generated types and themes, typecheck, build, unit: 18169 pass, 0 fail, 61 skip in 986 files).which this pull request's own run covers.