Skip to content

Harden npm publish tag handling against template injection#309

Merged
albe merged 1 commit into
mainfrom
copilot/fix-code-injection-vulnerability
May 10, 2026
Merged

Harden npm publish tag handling against template injection#309
albe merged 1 commit into
mainfrom
copilot/fix-code-injection-vulnerability

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 10, 2026

Summary

Fix code-injection risk in .github/workflows/npm-publish.yml by removing direct template expansion inside a shell assignment.

Changes

  • Move tag expression to step environment variable:
    • TAG: ${{ inputs.tag || github.event.release.tag_name }}
  • Enable strict shell mode in the step:
    • set -euo pipefail
  • Validate tag format before use to prevent unsafe values:
    • allow v<semver> plus optional prerelease/build suffix style segments
  • Keep existing version/tag consistency check unchanged in behavior

Validation

  • npm test (before change): passed
  • npm test (after change): passed
  • Parallel validation:
    • Code Review: no comments
    • CodeQL Security Scan: 0 alerts

Copilot AI requested a review from albe May 10, 2026 10:38
Copilot finished work on behalf of albe May 10, 2026 10:38
@albe albe marked this pull request as ready for review May 10, 2026 10:38
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 97.684%. remained the same — copilot/fix-code-injection-vulnerability into main

@albe albe merged commit de4f569 into main May 10, 2026
13 checks passed
@albe albe deleted the copilot/fix-code-injection-vulnerability branch May 10, 2026 10:43
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.

3 participants