Skip to content

Pin every action to a commit SHA, and let Dependabot move them - #314

Merged
parawanderer merged 1 commit into
parawanderer:mainfrom
lazzurs:ci/s03-pin-actions-by-sha
Nov 23, 2026
Merged

parawanderer merged 1 commit into
parawanderer:mainfrom
lazzurs:ci/s03-pin-actions-by-sha

Conversation

@lazzurs

@lazzurs lazzurs commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Fixes audit finding S-03: every uses: named a tag, and a tag can be moved to point at different code after anyone reviewed it (the tj-actions/changed-files pattern). Here a moved tag would run in jobs that hold a contents: write token, the release PAT, the keystore (see the S-02 PR) or the exporter build that users type their Apple ID into.

What changes

  • Every uses: in all 12 workflows that have one (49 lines; waiting-on-reporter.yml has none, and there are no composite actions or local reusable workflows) is now on the latest release of that action, pinned to the full commit SHA its release tag points at, with the exact version in a trailing comment, e.g. uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1. The one commented-out uses: in build-release.yml is pinned the same way, so it's right if anyone uncomments it.
  • .github/dependabot.yml: the github-actions ecosystem, directory /, weekly, with every action bump grouped into one PR and commits prefixed CI. Dependabot updates the SHA and the version comment together.
  • CONTRIBUTING.md: a paragraph under "What CI runs" saying actions are pinned and how, and that a Dependabot PR only touches .github/, so the build and static checks have to be dispatched against it by hand (AGENTS.md rule 16).
Action Was Now SHA
actions/checkout v7, v4 v7.0.1 3d3c42e5aac5ba805825da76410c181273ba90b1
actions/upload-artifact v7 v7.0.2 cf430e030ddbb5b0abf93d22962f4752f3646cd9
actions/download-artifact v8 v8.0.2 9000827ccba6bdab643e8b6fd33ac0654aef8333
actions/cache v6 v6.1.0 55cc8345863c7cc4c66a329aec7e433d2d1c52a9
actions/setup-python v7, v5 v7.1.0 6d4fd22b20465ccc0f7354476588e8df7c9ca0e0
actions/setup-java v6 v6.3.0 d1374f8ac74474200d16ef8ecee22c7ae7a51880
astral-sh/setup-uv v5 v10.4.0 1db35dd8eee11c5894872e0b383ae6c406cf738d
softprops/action-gh-release v2 v3.0.4 8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 (annotated tag, dereferenced to the commit)
peter-evans/create-pull-request v8 v8.1.3 3ffccacd46053766916f087ce41d627c0b8cf2d1

Each "latest" came from gh api repos/<o>/<r>/releases/latest, checked against the highest vX.Y.Z in the tag list (they agreed for all nine). Each SHA came from git/ref/tags/<tag>. Only softprops/action-gh-release's tag is annotated, and it was followed through git/tags/<sha> to the commit.

Major-version bumps, and what each needed

  • actions/checkout v4 → v7 (macadi-host.yml only; everything else was already on v7). v5 moved to Node 24, v6 persists credentials to a separate file instead of .git/config, v7 refuses to check out a fork PR under pull_request_target/workflow_run and moved to ESM. macadi-host.yml runs on pull_request/push/dispatch and passes no inputs. No changes needed.
  • actions/setup-python v5 → v7 (macadi-host.yml only). v6 moved to Node 24, v7 removed the pip-install input. Only python-version is passed. No changes needed.
  • astral-sh/setup-uv v5 → v10 (exporter-build-check.yml, macos-exporter-python.yml ×2, macos-scripts-python.yml). None of these steps pass inputs, and the venv comes from uv sync, so:
    • v6: python-version no longer activates a venv (not used); pyproject-file/uv-file removed (not used); default cache-dependency-glob widened. No change.
    • v7: Node 24; server-url removed (not used). No change.
    • v8: no more floating major/minor tags, so pinning is now the only way to follow it anyway. No change.
    • v9: prune-cache defaults to false, so caches can get somewhat larger. No change.
    • v10: enable-cache: auto now turns the cache off for release, pull_request_target and workflow_run events, against cache poisoning. That covers macos-exporter-python.yml's release builds, which will now install uv's packages uncached. It's a few seconds slower and it's the behaviour you'd want in a release job, so I left it.
  • softprops/action-gh-release v2 → v3 (build-release.yml, macos-exporter-python.yml). v3.0.0 only moves the runtime to Node 24. The 3.0.x patches add error reporting, Gitea asset replacement, and publishing existing draft releases as prereleases when prerelease: true is passed (we don't pass it). The inputs used here (files, name, tag_name, token) are unchanged. No changes needed.

Not in scope, noted

  • adi-on-bionic.yml has four image: matrix values. They aren't Docker images: they're Android system-image zip URLs from dl.google.com, used as inputs to a job, so there's nothing to SHA-pin here.
  • Dependabot for gradle, pip and uv (audit S-07 and S-06) is a reasonable follow-up. It's left out so this PR stays about actions.

Verified

  • actionlint across all workflows: nothing new. The only non-shellcheck finding is the existing macos-15-intel runner label that this actionlint version doesn't know about.
  • Every uses: line matches @<40 hex> # vX.Y.Z (grep).
  • Dispatched on my fork against this branch, all green: Static checks, Generate APK (Debug) (instrumented + JVM + bridge tests + APK), Exporter Tests (macos-scripts-python, uses setup-uv v10), Exporter Build Check (Windows, setup-uv v10), Emulated Mac (host) (macadi-host, the checkout v4→v7 and setup-python v5→v7 bumps), Apple's ADI on bionic (actions/cache, upload/download-artifact), Native stub tests. Run links: Generate APK (Debug) (884 instrumented tests, 0 failed), Static checks, Exporter Tests, Exporter Build Check, Emulated Mac (host), Apple's ADI on bionic, Native stub tests.
    • The first attempt at Generate APK (Debug) failed in DebugModeReachesEveryScreenTest ("no history row was built"). That's a time-of-day flake already on main, not this change: AMapWithTagsOnIt seeds its report at "now − 2 h", which lands on yesterday when the suite runs between 00:00 and 02:00 in the emulator's time zone (UTC on CI). The same test failed the same way on all three audit branches that night. A rerun of the failed job after 02:00 UTC passed.
  • .github/dependabot.yml parses as YAML. GitHub only validates it on the default branch, so its first real check is after merge.

Not verified

  • build-release.yml and macos-exporter-python.yml run only on a release (the exporter also on dispatch, but that uploads to an existing release), so softprops v3 and setup-uv v10 in the release path haven't run. I can't create releases. The next release of each is the first run.
  • update-contributors.yml (create-pull-request v8 → v8.1.3, a minor bump) opens a PR when it runs, so I didn't dispatch it.
  • check-gsa-edge.yml and check-adi-libraries.yml are disabled on my fork (scheduled workflows), and the latter opens issues, so neither was dispatched. Both use only checkout and setup-python, which the runs above exercise. check-gsa-edge runs on this PR anyway.

Maintainer actions

None required. Dependabot version updates start from dependabot.yml once it's on main. Its PRs will need the build and static checks dispatched by hand, because of the path filters (rule 16).

Relationship to the other two PRs

One of three independent PRs from the same audit (S-02, S-03, S-04), each branched from main. The S-02 PR (#313) rewrites build-release.yml (removing softprops/action-gh-release from it and adding artifact steps). Whichever of the two merges second needs a trivial rebase on uses: lines in that file only. The S-04 PR doesn't touch workflows.

🤖 Generated with Claude Code

Every `uses:` named a tag, and a tag can be moved to different code
after it was reviewed. That is how tj-actions/changed-files reached
thousands of repositories. Here a moved tag would run in jobs holding a
contents: write token, the release PAT, or the exporter build users
type their Apple ID into.

Each action is now on the latest release, pinned to the commit its tag
points at, with the full version in a trailing comment. Four were
major bumps: actions/checkout v4 -> v7 and actions/setup-python v5 -> v7
in macadi-host.yml, astral-sh/setup-uv v5 -> v10 in the three exporter
workflows, and softprops/action-gh-release v2 -> v3 in both release
workflows. None of the inputs these workflows pass changed; the notes
are in the pull request.

.github/dependabot.yml checks the github-actions ecosystem weekly and
groups every bump into one PR, moving SHAs and comments together.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@parawanderer parawanderer left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for this!

@parawanderer
parawanderer merged commit 9bdb1bd into parawanderer:main Nov 23, 2026
16 checks passed
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.

2 participants