Skip to content

security: Harden release workflow (repo guard + SHA256SUMS)#47

Merged
williajm merged 2 commits intomainfrom
security/release-hardening
Apr 14, 2026
Merged

security: Harden release workflow (repo guard + SHA256SUMS)#47
williajm merged 2 commits intomainfrom
security/release-hardening

Conversation

@williajm
Copy link
Copy Markdown
Owner

Summary

  • Restrict every release.yml job to the upstream repo via if: github.repository == 'williajm/forgery'
  • Generate SHA256SUMS.txt from collected dist artifacts, upload to the GitHub release
  • Add contents: write to the publish job so gh release upload works for both SBOM and SHA256SUMS (job-level permissions replace workflow-level)

Context

Aligns this repo with the security baseline in williajm/mcp_docker. Sister PRs:

Also added a v* tag deployment policy to the pypi environment (done out-of-band via the GitHub API).

Notes

The existing SBOM release upload relied on the workflow-level contents: write but was overridden by the publish job's narrower permissions block. This PR fixes that inadvertently by declaring contents: write at job level.

Test plan

  • CI passes
  • Next tagged release publishes SHA256SUMS.txt + SBOM to the GitHub release
  • sha256sum --ignore-missing -c SHA256SUMS.txt verifies downloaded artifacts

🤖 Generated with Claude Code

Align with the security baseline used in williajm/mcp_docker:

- Add `if: github.repository == 'williajm/forgery'` to every job so
  forks can't run the release workflow (belt-and-suspenders with the
  trusted-publisher binding and the pypi environment's branch/tag
  policy).
- Generate SHA256SUMS.txt from the collected dist/* artifacts in the
  publish job, place it at the workspace root (outside dist/ so PyPI
  does not receive it), and upload it to the GitHub release.
- Add `contents: write` to the publish job's permissions explicitly
  so `gh release upload` works for both the SBOM and the new
  SHA256SUMS upload (job-level permissions replace workflow-level).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Fixes CVE-2025-71176 (pytest through 9.0.2 uses predictable
/tmp/pytest-of-{user} directory name, allowing local DoS or
privilege escalation).

Regenerated requirements-dev.txt via:
  uv pip compile pyproject.toml --extra dev --universal \
    --generate-hashes --upgrade-package pytest \
    --exclude-newer <3 days ago>

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@williajm
Copy link
Copy Markdown
Owner Author

Bundled dep bump: pytest 9.0.2 → 9.0.3 (CVE-2025-71176). Was failing pip-audit in CI — fix included here so the PR is mergeable.

@sonarqubecloud
Copy link
Copy Markdown

@williajm williajm merged commit 9503a31 into main Apr 14, 2026
13 checks passed
@williajm williajm deleted the security/release-hardening branch April 14, 2026 20:16
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.

1 participant