ci(release): extract post-publish main sync into its own job#20
ci(release): extract post-publish main sync into its own job#20isaacbmiller wants to merge 1 commit intomainfrom
Conversation
|
@greptile |
Greptile SummaryThis PR isolates the post-publish version sync into its own
Confidence Score: 4/5Safe to merge after addressing the re-run failure risk for the release branch conflict. The core security improvement is well-implemented and correct. The P1 finding (workflow re-run fails if the release branch already exists) is a real operational defect that could block recovery from a publish-job failure, warranting a score of 4 rather than 5.
Important Files Changed
Sequence DiagramsequenceDiagram
participant T as Tag Push
participant ET as extract-tag
participant TP as build-and-publish-test-pypi<br/>(id-token: write)
participant PP as build-and-publish-pypi<br/>(id-token: write only)
participant SV as sync-version-to-main<br/>(contents: write only)
participant R as Remote (PyPI / GitHub)
T->>ET: trigger on tag push
ET->>TP: version output
TP->>R: publish to TestPyPI
TP->>PP: success signal
PP->>R: publish dspy + dspy-ai to PyPI
PP->>SV: success signal
SV->>SV: checkout tag + sed re-derive files
SV->>R: push release-X.Y.Z branch
SV->>SV: merge release branch into main
SV->>R: git push origin main
|
The build-and-publish-pypi job currently holds both id-token: write and contents: write. id-token is required for PyPI Trusted Publishing; contents: write is used only for the 'Update versions' commit + merge into main that runs after the upload. Holding both permissions in the same OIDC-minting job means any compromised step (malicious test dep, poisoned sed, etc.) could both publish a package AND push to main before anyone notices. This PR moves the git work into a new sync-version-to-main job with only contents: write. The publish job now carries only id-token: write. The new job re-applies the same sed edits deterministically from the tag ref rather than accepting any artifact from the publishing job - that way even a compromised build/publish step cannot plant arbitrary file contents into the commit that lands on main. Refs PyPI security-model guidance: https://docs.pypi.org/trusted-publishers/security-model/ ('Limit the scope of your publishing job'). Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
14c719f to
de6933a
Compare
Isolates git-push from the OIDC-holding PyPI publish job (Critical #3).
build-and-publish-pypi: permissions: id-token: write - contents: write + # git steps removed from this job + + sync-version-to-main: + needs: [extract-tag, build-and-publish-pypi] + permissions: + contents: write + steps: + # re-apply sed edits + git-auto-commit + merge + pushRationale
build-and-publish-pypicurrently holds bothid-token: write(required for Trusted Publishing) andcontents: write(used only for the post-publish 'Update versions' merge back to main). A compromised step in that job could both publish a package and push to main.This PR moves the git work into a new
sync-version-to-mainjob with onlycontents: write. The publish job keeps onlyid-token: write. The new job re-derives file contents from the tag ref via sed (deterministic), rather than accepting any artifact from the privileged publishing job.Net behavior: identical. Same branch name, same commit message, same merge-to-main.