Repository navigation
ci: pass the route workflows one secret instead of all and stop storing checkout tokens - #9522
Totara-thib wants to merge 8 commits into
Conversation
The sixteen route jobs call mellifera-route.yml and mellifera-route-matrix.yml with `secrets: inherit`, which passes every secret the calling workflow can read, GH_TOKEN and CODECOV_TOKEN included. The two workflows read a single secret, MELLIFERA_PLACEMENT_TOKEN. Each call now passes that secret by name and the two workflows declare it as optional, so a run without it (a pull request from a fork) still falls back to the hosted label as before.
mellifera-route.yml and mellifera-route-matrix.yml declare no permissions, so their route job takes whatever the caller grants, today `contents: read` plus `actions: write`. The job reads the vendored runner-select and asks the placement endpoint with its own bearer token. It never uses the job token to write, so both workflows now declare `contents: read`.
Eighteen checkouts leave the job token in the git configuration until the job ends. Those jobs then install dependencies and build, and none of them runs an authenticated git command: the git calls they make are local (`git diff`, `git ls-files`, `git rev-parse`). On a run from this repository that token carries `actions: write`, and `pages: write` in the API reference build. They now set `persist-credentials: false`, as the checkout in mellifera-route-matrix.yml already does. The publish checkout is left alone, the release job pushes the version commit and the tags with the token it stores.
guidepup/setup-action was archived on 2026-09-26 and its README now says to use the @guidepup/setup CLI directly. The action was a thin wrapper: it appended `--ci` and `--record` and loaded the CLI it shipped with, release 0.23.0 for the pinned v0.21.0. The two screen recording steps now call that same CLI release with the same flags through npx, so setup-node moves above them. The CLI exits 1 when it cannot finish the setup, which is what it does on the hosted macOS image today, with the action as well. `|| true` keeps that from adding an error annotation to every run. Two things are not carried over. The action tried to set the screen resolution through VMware Tools, a workaround for the macos-11 images whose failure it ignored. And the action carried its dependencies in its repository, where npx resolves the five dependencies of the CLI when the step runs.
Every action is already pinned by commit and the pins stay exactly as written: the file comes from `gh actions-lock --no-narrow` and no workflow changes. .github/workflows/actions.lock is GitHub's workflow dependency lockfile. Next to each pinned commit it records the release tag and the owner and repository ids, so a run rejects a commit that is not reachable from that tag in the action's own repository, or a repository that is no longer the one that was locked. It also lists the two actions that codecov-action and upload-pages-artifact call. Dependabot regenerates the entry when it bumps a pin. After a pin changed by hand, or a merge that touches the file, run `gh actions-lock --no-narrow` again.
russellwheatley
left a comment
There was a problem hiding this comment.
Commits 1 to 3 look good to me. The route workflows only read MELLIFERA_PLACEMENT_TOKEN plus vars.*, and none of the jobs that lose persist-credentials push, fetch or call gh afterwards. Requested a change on the guidepup commit, see inline.
@mikehardy what do you think about adopting actions.lock? I checked the generated file against GitHub. Every entry resolves to its tagged commit in the real upstream repo (owner and repo IDs match, nothing from forks). The nested pins inside upload-pages-artifact and codecov-action match their action.yml, and no existing pin changed. So the file itself is fine. The question is more whether we want the workflow that comes with it:
- When it's out of sync: as I read the docs, a job that uses an action missing from the lockfile fails when it reaches that step at run time (
lockfile missing pin for ...). Earlier steps have already run by then, and nothing flags it when the PR is opened. A commit that's no longer reachable from its recorded tag (e.g. a force-moved tag) is also rejected at run time. - Contributor overhead: Dependabot regenerates entries when it bumps an action, but it doesn't onboard new workflows. Adding a workflow or a new action by hand means installing the
gh actions-lockextension, running it and committing the result. Outside contributors will mostly find out from a red CI run. - Review overhead: the lockfile diff can't be checked by eye, so we'd want
gh actions-lock --verifyin the loop. A fork PR can change a workflow and its lock entry in the same commit, so it doesn't protect us from a malicious PR, only from upstream tag or repo tampering. GitHub recommends CODEOWNERS onactions.lock, and we don't have a CODEOWNERS file today. - Coverage gaps: local
$/actions (runner-select), reusable workflows and container images aren't locked. - What it adds over our SHA pins: a repo identity check (catches a renamed or transferred repo), tag reachability, and pins for actions nested inside composite actions (e.g. codecov's
github-script). Enforcing it repo-wide is a separate "Require lockfile" policy in settings.
I could go either way on it. If we don't want it, the lockfile commit is easy to drop.
| if: env.RNFB_RECORD_SCREENS == '1' | ||
| with: | ||
| record: true | ||
| run: npx --yes @guidepup/setup@0.23.0 --ci --record || true |
There was a problem hiding this comment.
I'd rather drop this commit. The old action was pinned by SHA and the repo is archived, so its bundled code can't change. npx --yes @guidepup/setup@0.23.0 only pins the top-level package. Its dependencies (decompress, https-proxy-agent, chalk, semver) are caret ranges resolved fresh from npm on every run, with no lockfile. This step runs on macOS jobs that can land on our self-hosted runners and it changes TCC permissions, so I think it's a step backwards for supply chain. Can you revert to the pinned guidepup/setup-action and regenerate actions.lock so it picks it up again?
| continue-on-error: true | ||
| with: | ||
| record: true | ||
| run: npx --yes @guidepup/setup@0.23.0 --ci --record || true |
There was a problem hiding this comment.
Same as above, revert to the pinned action here too.
This takes back the previous change to the two screen recording steps, as asked in review. They use guidepup/setup-action at commit 5d19b11 (v0.21.0) again, with `record: true`, and setup-node returns to its place after them. The action is archived, pinned by commit, and carries its dependencies in its repository. The npx call pinned only the CLI package and resolved the CLI's own dependencies from npm on every run. Both workflow files are back to what they were before that change.
The pin as it was, 5d19b11, is no longer on any branch or tag of guidepup/setup-action. The history of that repository was rewritten at some point: its `0.21.0` tag and `main` now carry acf1a64, a commit with the same message, the same date and the same tree (f686590), so the files the step runs are identical. `gh actions-lock` does not lock a commit that no branch or tag of the action's repository contains, so the lockfile can only record the tagged one. Only the commit id changes in the two recording steps.
`gh actions-lock --no-narrow` again, now that the two recording steps use the action. It adds one entry, guidepup/setup-action at acf1a64 with its `0.21.0` tag and the owner and repository ids, and lists it under the iOS and the macOS e2e workflows. Nothing else in the file changes and no workflow file is touched.
|
@russellwheatley done. The pinned One thing to check: the old commit On the lockfile: GitHub's guide runs |
Description
Hello, some CI hardening contributions:
The sixteen route jobs call their workflow with
secrets: inherit, so it receives every secret the caller can read, the adminGH_TOKENincluded. A compromised step takes whatever its job holds (the tj-actions incident, CVE-2025-30066).Five commits:
MELLIFERA_PLACEMENT_TOKENby name, and the two route workflows getpermissions: contents: read.guidepup/setup-actionis archived. The recording steps call the CLI it wrapped through npx, same release and flags, dependencies no longer vendored.actions.lock, GitHub's workflow dependency lockfile (gh actions-lock --no-narrow): your pins stay as written and a run rejects a commit not reachable from its tag. Dependabot updates it, a manual bump reruns the command. Say so and I drop it.Related issues
None.
Release Summary
Checklist
AndroidiOSOther(macOS, web)e2etests added or updated inpackages/\*\*/e2ejesttests added or updated inpackages/\*\*/__tests__Test Plan
My fork ran every pull request workflow green, e2e included. Publish and the API reference deploy did not run. The recording setup fails as on
main: the hosted image refuses the TCC.db write.Found and fixed with Plumber (C 70/100 before, up to A 98/100 after), reviewed and submitted by me.
🔥