Skip to content

Harden PyPI publishing supply chain - #7

Merged
parkjinman98 merged 2 commits into
mainfrom
codex/fix-mutable-release-dependencies-vulnerability
Sep 22, 2026
Merged

parkjinman98 merged 2 commits into
mainfrom
codex/fix-mutable-release-dependencies-vulnerability

Conversation

@parkjinman98

Copy link
Copy Markdown
Contributor

Motivation

  • A release-workflow supply-chain weakness allowed mutable GitHub Action tags and unpinned build tooling, which could let an upstream compromise alter published artifacts and request OIDC tokens.
  • The change locks the executable surface used during release (actions and build tooling) to immutable artifacts and adds local artifact verification to prevent publishing tampered distributions.

Description

  • Pin all workflow uses: references in .github/workflows/publish.yml to reviewed full commit SHAs and replace dynamic installs with reproducible inputs for build tooling.
  • Add .github/build-requirements.txt and change pyproject.toml build-system.requires to exact setuptools==80.9.0 and wheel==0.45.1 so the build dependencies are exact and hash-verified.
  • Replace python -m build with a controlled build using setuptools.build_meta that writes sdist/wheel into release/packages, generate SHA256SUMS, and upload the release/ bundle (not the package dir) as the artifact.
  • Verify artifact integrity before publishing by checking SHA256SUMS in both the TestPyPI and production publish jobs and pass packages-dir to the publishing action.

Testing

  • Ran python -m pytest -q and all tests passed (84 passed).
  • Performed local sdist/wheel builds using the locked setuptools/wheel artifacts and verified archives by running sha256sum --check SHA256SUMS.
  • Parsed .github/workflows/publish.yml with PyYAML and ran a static assertion that every uses: reference ends in a full 40-character commit SHA.
  • Ran git diff --check and a lint pass; ruff reports are expected because YAML/TOML are not Python source and no functional Python files were changed.

Codex Task

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-22T08:53:27.721643Z 43b5200 Manual request
🔒 Security Review ✅ Completed 2026-09-22T08:58:23.149753Z 43b5200 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9662d62e2e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/publish.yml Outdated
@parkjinman98 parkjinman98 self-assigned this Sep 22, 2026
@parkjinman98

Copy link
Copy Markdown
Contributor Author

@codex review

The prior P1 is addressed in 43b5200. Please review both publish jobs and verify the invariant before either PyPI action runs: the sorted filenames represented by SHA256SUMS must exactly equal every direct entry in release/packages, after which sha256sum --strict --check verifies content. In particular, test an added unlisted .whl or .tar.gz; it must fail at the set comparison rather than reach publishing.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 43b5200396

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 43b5200396

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@parkjinman98
parkjinman98 merged commit 16d2dd1 into main Sep 22, 2026
3 checks passed
@parkjinman98
parkjinman98 deleted the codex/fix-mutable-release-dependencies-vulnerability branch September 22, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant