Skip to content

ci(api-docs/py): bring pypi's cache-poisoning fix upstream, reconcile pins - #135

Merged
WomB0ComB0 merged 1 commit into
mainfrom
ci/python-template-reconcile
Sep 22, 2026
Merged

WomB0ComB0 merged 1 commit into
mainfrom
ci/python-template-reconcile

Conversation

@WomB0ComB0

Copy link
Copy Markdown
Member

The python counterpart to #134. Same three buckets, same conclusion.

What was drifting

automation/source-repo-templates/api-docs.python.yml vs what pypi actually runs:

Line Direction Action
enable-cache: false on setup-uv downstream only brought upstream
4 action pins, 1–4 majors behind template behind consumer bumped to match

The security line

pypi set enable-cache: false in resq-software/pypi#48 (commit de461aa4, 2026-05-10) to close a zizmor cache-poisoning finding — alert #44 in that repo. The template never received it.

That matters because automation/sync-templates.sh line 89 is a plain cp: no merge, no conflict detection. The next sync deletes every downstream line. This job opens a cross-repo PR with DOCS_REPO_PR_TOKEN, so it runs privileged — restoring a cache a less-trusted run could have populated is exactly the exposure the alert named.

The comment is rewritten, not copied

pypi's rationale says setup-uv "enables caching by default". That was true at v6.0.0. At v10.1.0 the default is auto, whose own description reads: "enables caching on GitHub-hosted runners except for release, tag push, pull_request_target, and workflow_run events."

So upstream now handles the tag-push case pypi's comment cites. The opt-out is still load-bearing, for a case the original comment doesn't mention: workflow_dispatch is not in that exclusion list, and every recorded run of these workflows across all five consumers has been workflow_dispatch. The comment now says that.

Why the pins moved too

The templates sit in automation/, not .github/workflows/ — the only path Dependabot's github-actions ecosystem scans. So they receive no bump PRs while every consumer with a Dependabot config drifts forward weekly. The template was behind pypi by:

  • actions/checkout v6.0.2 → v7.0.1 (×2)
  • actions/setup-python v5.6.0 → v7.0.0
  • astral-sh/setup-uv v6.0.0 → v10.1.0
  • peter-evans/create-pull-request v7.0.8 → v8.1.1

Syncing before this PR would have rolled all four backward on pypi.

Verification

  • Each SHA resolves to its commented tag, checked against upstream refs/tags — not assumed from the comment.
  • Every input the template passes is declared by the bumped version, parsed from each action.yml at the pinned SHA. create-pull-request v7→v8 is the only risky one: the template passes 12 inputs, v8 declares 24, all 12 present.
  • actionlint clean.
  • Cited commit and PR number confirmed via the API rather than taken from an intermediate report.

Not addressed here

The mechanism is still a hand-run laptop script that last fired 2026-05-10. This PR makes a sync safe for pypi; it does not make syncing automatic or safe in general.

… pins

pypi set `enable-cache: false` on setup-uv downstream in
resq-software/pypi#48 to close a zizmor cache-poisoning finding, and
the template never received it. `automation/sync-templates.sh` is a
blind `cp`, so the next run would have deleted the mitigation.

Also bumps the four action pins to the versions pypi actually runs.
The templates live outside `.github/workflows/`, which is the only
path Dependabot's github-actions ecosystem scans, so they get no bump
PRs. The template had fallen 1-4 majors behind every consumer, meaning
a sync today would have rolled those pins backward.

The rationale comment is rewritten rather than copied across. pypi's
version says setup-uv "enables caching by default"; at v10.1.0 the
default is `auto`, which already skips the cache on tag pushes. The
case that still needs an explicit opt-out is workflow_dispatch -- the
trigger these runs actually use.

Verified: each SHA resolves to its commented tag; every input the
template passes is declared by the bumped version (create-pull-request
v7 -> v8 uses 12 of the 24 inputs v8 declares); actionlint clean.
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: a3f412d8-52af-44bc-8720-93abe28fed1d

📥 Commits

Reviewing files that changed from the base of the PR and between 09b16f5 and 01b12e8.

📒 Files selected for processing (1)
  • automation/source-repo-templates/api-docs.python.yml

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the area:content MDX/MD documentation content label Sep 22, 2026
@WomB0ComB0
WomB0ComB0 merged commit c453e44 into main Sep 22, 2026
23 checks passed
@WomB0ComB0
WomB0ComB0 deleted the ci/python-template-reconcile branch September 22, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:content MDX/MD documentation content

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant