Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
push:
branches:
- main
workflow_dispatch:
Comment thread
cursor[bot] marked this conversation as resolved.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Manual dispatch allows publishing from any branch

Medium Severity

The push trigger is restricted to main, but workflow_dispatch has no branch restriction and doesn't support native branch filtering. Anyone with write access can manually trigger this workflow from any branch, potentially publishing unreleased or broken code to npm. The release job needs a github.ref == 'refs/heads/main' guard (or equivalent) to match the safety of the push trigger.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1c6879d. Configure here.


jobs:
lint:
Expand Down Expand Up @@ -49,21 +50,21 @@ jobs:
- uses: actions/checkout@v4
# these if statements ensure that a publication only occurs when
# a new release is created:
if: ${{ steps.release.outputs.releases_created == 'true' }}
if: ${{ steps.release.outputs.releases_created == 'true' || github.event_name == 'workflow_dispatch' }}

- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
if: ${{ steps.release.outputs.releases_created == 'true' }}
if: ${{ steps.release.outputs.releases_created == 'true' || github.event_name == 'workflow_dispatch' }}

- run: npm ci
if: ${{ steps.release.outputs.releases_created == 'true' }}
if: ${{ steps.release.outputs.releases_created == 'true' || github.event_name == 'workflow_dispatch' }}

- run: npm run build
if: ${{ steps.release.outputs.releases_created == 'true' }}
if: ${{ steps.release.outputs.releases_created == 'true' || github.event_name == 'workflow_dispatch' }}

- run: npm exec -c publish-packages
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release.outputs.releases_created == 'true' }}
if: ${{ steps.release.outputs.releases_created == 'true' || github.event_name == 'workflow_dispatch' }}
Loading