Skip to content

fix(ci): harden npm publish release workflow - #52

Open
Gumball12 wants to merge 1 commit into
mainfrom
codex/fix-release-workflow-security-vulnerability
Open

Gumball12 wants to merge 1 commit into
mainfrom
codex/fix-release-workflow-security-vulnerability

Conversation

@Gumball12

Copy link
Copy Markdown
Owner

Motivation

  • The existing publish workflow triggered on any release.created event and checked out the release tag implicitly, allowing an attacker with tag/release permissions to publish arbitrary, unreviewed code with NPM_TOKEN.
  • The change is intended to add minimal provenance checks so only reviewed/approved releases that match the package version and are reachable from main can be published.

Description

  • Update .github/workflows/publish.yaml to trigger on release.published instead of release.created to reduce attack surface for premature releases.
  • Make the checkout explicit by adding ref: refs/tags/${{ github.event.release.tag_name }} to the actions/checkout step so the job ref is deliberate and auditable.
  • Add a validation step that runs git fetch --no-tags origin main, verifies git merge-base --is-ancestor "$GITHUB_SHA" origin/main, and enforces the release tag equals v<packages/text-vide/package.json version> using node -p.
  • Preserve the existing lint, test, build, and npm publish steps so the publish flow remains functionally the same when validations pass.

Testing

  • Ran pnpm run lint in the repository and it completed successfully.
  • No automated publish was executed in this environment; pnpm run test and pnpm run build were not executed here but remain unchanged in the workflow.

Codex Task

@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8adb359) to head (c97f5e3).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #52   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines           80       107   +27     
  Branches        11        17    +6     
=========================================
+ Hits            80       107   +27     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Gumball12 Gumball12 self-assigned this Oct 12, 2026
@Gumball12
Gumball12 marked this pull request as ready for review October 12, 2026 01:15

This branch has not been deployed

No deployments
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