-
Notifications
You must be signed in to change notification settings - Fork 1
fix: Node release custom package path #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
| contents="$(jq '.version = "${{ steps.semver.outputs.new_version }}"' package.json)" | ||
| echo -E "${contents}" > package.json | ||
| contents="$(jq '.version = "${{ steps.semver.outputs.new_version }}"' ${PACKAGE_PATH}package.json)" | ||
| echo -E "${contents}" > ${PACKAGE_PATH}package.json |
Check warning
Code scanning / CodeQL
Code injection Medium
${ steps.semver.outputs.new_version }
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 28 days ago
The best way to fix this problem is to avoid directly interpolating untrusted values (such as ${{ steps.semver.outputs.new_version }}) into shell scripts or commands, especially when using double quotes or here-documents. Instead, assign expressions like ${{ steps.semver.outputs.new_version }} to an environment variable using the env: block, and then reference that variable within your shell script using the shell's native syntax (e.g., $NEW_VERSION). This prevents shell interpretation of potentially malicious input and adheres to GitHub's safe usage guidelines.
Specifically, in file node-release/action.yml, edit the block for "Push New Version".
- In the step starting at line 107, update the
env:block to includeNEW_VERSION: ${{ steps.semver.outputs.new_version }}. - Then, update line 113 to reference
$NEW_VERSIONwithin single quotes in thejqcommand:jq '.version = "'$NEW_VERSION'"' ....
-
Copy modified line R112 -
Copy modified line R114 -
Copy modified line R121 -
Copy modified line R123
| @@ -109,17 +109,18 @@ | ||
| shell: bash | ||
| env: | ||
| PACKAGE_PATH: ${{ inputs.package_path }} | ||
| NEW_VERSION: ${{ steps.semver.outputs.new_version }} | ||
| run: | | ||
| contents="$(jq '.version = "${{ steps.semver.outputs.new_version }}"' ${PACKAGE_PATH}package.json)" | ||
| contents="$(jq '.version = "'$NEW_VERSION'"' ${PACKAGE_PATH}package.json)" | ||
| echo -E "${contents}" > ${PACKAGE_PATH}package.json | ||
|
|
||
| git add . | ||
| git config --global user.email "[email protected]" | ||
| git config --global user.name "pagopa-github-bot" | ||
| if [ "${{ inputs.skip_ci }}" = "true" ]; then | ||
| git commit -m "Bump to version ${{ steps.semver.outputs.new_version }} [skip ci]" || exit 0 | ||
| git commit -m "Bump to version $NEW_VERSION [skip ci]" || exit 0 | ||
| else | ||
| git commit -m "Bump to version ${{ steps.semver.outputs.new_version }}" || exit 0 | ||
| git commit -m "Bump to version $NEW_VERSION" || exit 0 | ||
| fi | ||
| git push origin ${{ github.ref_name}} | ||
|
|
|
🎉 This PR is included in version 2.3.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
List of Changes
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: