-
Notifications
You must be signed in to change notification settings - Fork 246
Internal: Clone Release workflow [TMZ-803] #532
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
| shell: bash | ||
| run: | | ||
| if [ ! -f "${{ inputs.BUILD_ZIP_PATH }}" ]; then | ||
| echo "Error: Build zip file not found: ${{ inputs.BUILD_ZIP_PATH }}" |
Check warning
Code scanning / CodeQL
Code injection Medium
${ inputs.BUILD_ZIP_PATH }
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
The best fix is to pass user-controlled inputs (like BUILD_ZIP_PATH and CHANGELOG_FILE) to the script as environment variables using the env: block in the step, and to reference those entries within the shell script using the native shell variable syntax ("$BUILD_ZIP_PATH"). This ensures the shell receives the literal input as a variable, not as an evaluated shell statement, which prevents injection vulnerabilities.
Specifically, in file .github/actions/create-theme-release-release/action.yml:
- Update the "Verify files exist" and "Release summary" steps to set all input values used in shell commands under an
env:block. - Update all script references from
${{ inputs.BUILD_ZIP_PATH }}(and similar) to"$BUILD_ZIP_PATH", etc. - This fix involves only the lines within the two shell
run:script steps.
-
Copy modified lines R31-R33 -
Copy modified lines R35-R36 -
Copy modified lines R40-R41 -
Copy modified lines R45-R46 -
Copy modified lines R56-R60 -
Copy modified lines R64-R68
| @@ -28,20 +28,22 @@ | ||
| steps: | ||
| - name: Verify files exist | ||
| shell: bash | ||
| env: | ||
| BUILD_ZIP_PATH: ${{ inputs.BUILD_ZIP_PATH }} | ||
| CHANGELOG_FILE: ${{ inputs.CHANGELOG_FILE }} | ||
| run: | | ||
| if [ ! -f "${{ inputs.BUILD_ZIP_PATH }}" ]; then | ||
| echo "Error: Build zip file not found: ${{ inputs.BUILD_ZIP_PATH }}" | ||
| if [ ! -f "$BUILD_ZIP_PATH" ]; then | ||
| echo "Error: Build zip file not found: $BUILD_ZIP_PATH" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -f "${{ inputs.CHANGELOG_FILE }}" ]; then | ||
| echo "Error: Changelog file not found: ${{ inputs.CHANGELOG_FILE }}" | ||
| if [ ! -f "$CHANGELOG_FILE" ]; then | ||
| echo "Error: Changelog file not found: $CHANGELOG_FILE" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "✅ Build zip: ${{ inputs.BUILD_ZIP_PATH }}" | ||
| echo "✅ Changelog: ${{ inputs.CHANGELOG_FILE }}" | ||
|
|
||
| echo "✅ Build zip: $BUILD_ZIP_PATH" | ||
| echo "✅ Changelog: $CHANGELOG_FILE" | ||
| - name: Create GitHub release | ||
| id: create-release | ||
| uses: softprops/action-gh-release@v1 | ||
| @@ -58,11 +53,16 @@ | ||
|
|
||
| - name: Release summary | ||
| shell: bash | ||
| env: | ||
| PACKAGE_VERSION: ${{ inputs.PACKAGE_VERSION }} | ||
| PRE_RELEASE: ${{ inputs.PRE_RELEASE }} | ||
| BUILD_ZIP_PATH: ${{ inputs.BUILD_ZIP_PATH }} | ||
| RELEASE_URL: ${{ steps.create-release.outputs.html_url }} | ||
| run: | | ||
| echo "🚀 **Release Created Successfully!**" | ||
| echo "📋 **Release Details:**" | ||
| echo " - Version: v${{ inputs.PACKAGE_VERSION }}" | ||
| echo " - Pre-release: ${{ inputs.PRE_RELEASE }}" | ||
| echo " - Build file: ${{ inputs.BUILD_ZIP_PATH }}" | ||
| echo " - Release URL: ${{ steps.create-release.outputs.html_url }}" | ||
| echo "RELEASE_URL=${{ steps.create-release.outputs.html_url }}" >> $GITHUB_ENV | ||
| echo " - Version: v$PACKAGE_VERSION" | ||
| echo " - Pre-release: $PRE_RELEASE" | ||
| echo " - Build file: $BUILD_ZIP_PATH" | ||
| echo " - Release URL: $RELEASE_URL" | ||
| echo "RELEASE_URL=$RELEASE_URL" >> $GITHUB_ENV |
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -f "${{ inputs.CHANGELOG_FILE }}" ]; then |
Check warning
Code scanning / CodeQL
Code injection Medium
${ inputs.CHANGELOG_FILE }
| fi | ||
|
|
||
| if [ ! -f "${{ inputs.CHANGELOG_FILE }}" ]; then | ||
| echo "Error: Changelog file not found: ${{ inputs.CHANGELOG_FILE }}" |
Check warning
Code scanning / CodeQL
Code injection Medium
${ inputs.CHANGELOG_FILE }
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the problem, we should avoid using ${{ inputs.CHANGELOG_FILE }} directly inside command lines in run: blocks. The correct and safest fix is to:
- Assign the expression value to an environment variable via the
env:directive. - Reference the environment variable in the shell script using native shell syntax (e.g.,
$CHANGELOG_FILE) rather than further GitHub Action expressions.
Specifically, in the "Verify files exist" step, we should:
- Set
CHANGELOG_FILE: ${{ inputs.CHANGELOG_FILE }}in theenv:block. - Replace any shell interpolations
${{ inputs.CHANGELOG_FILE }}with$CHANGELOG_FILE.
Do the same for other user-provided inputs (BUILD_ZIP_PATH) used in shell context for full coverage, but the flagged line is focused on CHANGELOG_FILE. Other usages (such as inside with: for actions) are not executed as shell scripts and thus are not susceptible in the same way.
No new external dependencies or method definitions are needed—just the use of existing GitHub Actions syntax.
-
Copy modified lines R31-R33 -
Copy modified lines R35-R36 -
Copy modified lines R40-R41 -
Copy modified lines R45-R46
| @@ -28,19 +28,22 @@ | ||
| steps: | ||
| - name: Verify files exist | ||
| shell: bash | ||
| env: | ||
| BUILD_ZIP_PATH: ${{ inputs.BUILD_ZIP_PATH }} | ||
| CHANGELOG_FILE: ${{ inputs.CHANGELOG_FILE }} | ||
| run: | | ||
| if [ ! -f "${{ inputs.BUILD_ZIP_PATH }}" ]; then | ||
| echo "Error: Build zip file not found: ${{ inputs.BUILD_ZIP_PATH }}" | ||
| if [ ! -f "$BUILD_ZIP_PATH" ]; then | ||
| echo "Error: Build zip file not found: $BUILD_ZIP_PATH" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -f "${{ inputs.CHANGELOG_FILE }}" ]; then | ||
| echo "Error: Changelog file not found: ${{ inputs.CHANGELOG_FILE }}" | ||
| if [ ! -f "$CHANGELOG_FILE" ]; then | ||
| echo "Error: Changelog file not found: $CHANGELOG_FILE" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "✅ Build zip: ${{ inputs.BUILD_ZIP_PATH }}" | ||
| echo "✅ Changelog: ${{ inputs.CHANGELOG_FILE }}" | ||
| echo "✅ Build zip: $BUILD_ZIP_PATH" | ||
| echo "✅ Changelog: $CHANGELOG_FILE" | ||
|
|
||
| - name: Create GitHub release | ||
| id: create-release |
| exit 1 | ||
| fi | ||
|
|
||
| echo "✅ Build zip: ${{ inputs.BUILD_ZIP_PATH }}" |
Check warning
Code scanning / CodeQL
Code injection Medium
${ inputs.BUILD_ZIP_PATH }
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix the issue, we should stop interpolating the expression ${{ inputs.BUILD_ZIP_PATH }} directly into the shell command. Instead, we should assign inputs.BUILD_ZIP_PATH (and similarly, inputs.CHANGELOG_FILE) to environment variables at the step level, and reference them in the shell using "${BUILD_ZIP_PATH}". This approach avoids code injection regardless of the value of the input, because the shell will not interpret injected special characters as part of its command structure. The fix should be applied to every occurrence where an untrusted input is interpolated directly, specifically lines 32, 33, 37, 38, 42, and 43 of the run: block in the "Verify files exist" step. The same should be done in other relevant steps if needed (but the error was raised for line 42). Changes are only within the shown code of the .github/actions/create-theme-release-release/action.yml file.
The solution consists of:
- Adding an
env:block to the relevant step, assigninginputs.BUILD_ZIP_PATHandinputs.CHANGELOG_FILEto environment variables with safe names. - Replacing all direct uses of
${{ inputs.BUILD_ZIP_PATH }}and${{ inputs.CHANGELOG_FILE }}in the shell command with shell variable references$BUILD_ZIP_PATHand$CHANGELOG_FILE.
-
Copy modified lines R31-R33 -
Copy modified lines R35-R36 -
Copy modified lines R40-R41 -
Copy modified lines R45-R46
| @@ -28,19 +28,22 @@ | ||
| steps: | ||
| - name: Verify files exist | ||
| shell: bash | ||
| env: | ||
| BUILD_ZIP_PATH: ${{ inputs.BUILD_ZIP_PATH }} | ||
| CHANGELOG_FILE: ${{ inputs.CHANGELOG_FILE }} | ||
| run: | | ||
| if [ ! -f "${{ inputs.BUILD_ZIP_PATH }}" ]; then | ||
| echo "Error: Build zip file not found: ${{ inputs.BUILD_ZIP_PATH }}" | ||
| if [ ! -f "$BUILD_ZIP_PATH" ]; then | ||
| echo "Error: Build zip file not found: $BUILD_ZIP_PATH" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -f "${{ inputs.CHANGELOG_FILE }}" ]; then | ||
| echo "Error: Changelog file not found: ${{ inputs.CHANGELOG_FILE }}" | ||
| if [ ! -f "$CHANGELOG_FILE" ]; then | ||
| echo "Error: Changelog file not found: $CHANGELOG_FILE" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "✅ Build zip: ${{ inputs.BUILD_ZIP_PATH }}" | ||
| echo "✅ Changelog: ${{ inputs.CHANGELOG_FILE }}" | ||
| echo "✅ Build zip: $BUILD_ZIP_PATH" | ||
| echo "✅ Changelog: $CHANGELOG_FILE" | ||
|
|
||
| - name: Create GitHub release | ||
| id: create-release |
| echo "🚀 **Release Created Successfully!**" | ||
| echo "📋 **Release Details:**" | ||
| echo " - Version: v${{ inputs.PACKAGE_VERSION }}" | ||
| echo " - Pre-release: ${{ inputs.PRE_RELEASE }}" |
Check warning
Code scanning / CodeQL
Code injection Medium
${ inputs.PRE_RELEASE }
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix this issue, we need to ensure that any user-controlled input (such as ${{ inputs.PRE_RELEASE }}) is not directly interpolated into the script with ${{ }} expression syntax. Instead, it should first be assigned to an environment variable using env: and then referenced with the shell's native variable expansion ($PRE_RELEASE). Specifically, assign PRE_RELEASE to an environment variable via the env key within the workflow step, and in the bash script, use "$PRE_RELEASE" instead of ${{ inputs.PRE_RELEASE }}. This change only needs to be applied to the step that outputs the release summary (the step beginning at line 59). No changes in business logic or function should occur, just a switch to safe variable expansion.
Required changes:
- In the "Release summary" step, add an
env:section assigningPRE_RELEASE: ${{ inputs.PRE_RELEASE }}. - On line 65, replace
echo " - Pre-release: ${{ inputs.PRE_RELEASE }}"withecho " - Pre-release: $PRE_RELEASE"(i.e., use shell expansion). - No new imports or dependencies required.
-
Copy modified lines R61-R62 -
Copy modified line R67
| @@ -58,11 +58,13 @@ | ||
|
|
||
| - name: Release summary | ||
| shell: bash | ||
| env: | ||
| PRE_RELEASE: ${{ inputs.PRE_RELEASE }} | ||
| run: | | ||
| echo "🚀 **Release Created Successfully!**" | ||
| echo "📋 **Release Details:**" | ||
| echo " - Version: v${{ inputs.PACKAGE_VERSION }}" | ||
| echo " - Pre-release: ${{ inputs.PRE_RELEASE }}" | ||
| echo " - Pre-release: $PRE_RELEASE" | ||
| echo " - Build file: ${{ inputs.BUILD_ZIP_PATH }}" | ||
| echo " - Release URL: ${{ steps.create-release.outputs.html_url }}" | ||
| echo "RELEASE_URL=${{ steps.create-release.outputs.html_url }}" >> $GITHUB_ENV |
| echo "📋 **Release Details:**" | ||
| echo " - Version: v${{ inputs.PACKAGE_VERSION }}" | ||
| echo " - Pre-release: ${{ inputs.PRE_RELEASE }}" | ||
| echo " - Build file: ${{ inputs.BUILD_ZIP_PATH }}" |
Check warning
Code scanning / CodeQL
Code injection Medium
${ inputs.BUILD_ZIP_PATH }
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix this potential code injection vulnerability, the user-controlled input (BUILD_ZIP_PATH) should be passed to the shell script as an environment variable, rather than being directly interpolated into the script using ${{ ... }}. The correct pattern is to define an environment variable in the step (using env:), assign it the value from ${{ inputs.BUILD_ZIP_PATH }}, and then reference it inside the script using shell-native syntax ("$BUILD_ZIP_PATH"). This mitigates shell code injection risks. Lines 61-68 should be updated so that BUILD_ZIP_PATH and other user inputs used in echo and export statements are referenced from environment variables rather than interpolated directly. The environment variables can be set via the env: key of the step.
-
Copy modified lines R61-R65 -
Copy modified lines R69-R73
| @@ -58,11 +58,16 @@ | ||
|
|
||
| - name: Release summary | ||
| shell: bash | ||
| env: | ||
| PACKAGE_VERSION: ${{ inputs.PACKAGE_VERSION }} | ||
| PRE_RELEASE: ${{ inputs.PRE_RELEASE }} | ||
| BUILD_ZIP_PATH: ${{ inputs.BUILD_ZIP_PATH }} | ||
| RELEASE_URL: ${{ steps.create-release.outputs.html_url }} | ||
| run: | | ||
| echo "🚀 **Release Created Successfully!**" | ||
| echo "📋 **Release Details:**" | ||
| echo " - Version: v${{ inputs.PACKAGE_VERSION }}" | ||
| echo " - Pre-release: ${{ inputs.PRE_RELEASE }}" | ||
| echo " - Build file: ${{ inputs.BUILD_ZIP_PATH }}" | ||
| echo " - Release URL: ${{ steps.create-release.outputs.html_url }}" | ||
| echo "RELEASE_URL=${{ steps.create-release.outputs.html_url }}" >> $GITHUB_ENV | ||
| echo " - Version: v$PACKAGE_VERSION" | ||
| echo " - Pre-release: $PRE_RELEASE" | ||
| echo " - Build file: $BUILD_ZIP_PATH" | ||
| echo " - Release URL: $RELEASE_URL" | ||
| echo "RELEASE_URL=$RELEASE_URL" >> $GITHUB_ENV |
| echo " - Version: v${{ inputs.PACKAGE_VERSION }}" | ||
| echo " - Pre-release: ${{ inputs.PRE_RELEASE }}" | ||
| echo " - Build file: ${{ inputs.BUILD_ZIP_PATH }}" | ||
| echo " - Release URL: ${{ steps.create-release.outputs.html_url }}" |
Check warning
Code scanning / CodeQL
Code injection Medium
${ steps.create-release.outputs.html_url }
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To mitigate the code injection risk, the recommended solution is to store the value of ${{ steps.create-release.outputs.html_url }} in an environment variable in the step, then reference that variable within the bash script using $RELEASE_URL (shell variable syntax) rather than ${{ ... }}. This avoids direct interpolation of potentially user-controlled values inside the shell command, preventing code injection. The required change is to add env: RELEASE_URL: ${{ steps.create-release.outputs.html_url }} to the step and replace the shell usage of ${{ steps.create-release.outputs.html_url }} with $RELEASE_URL in the relevant locations (line 67 and line 68). No extra dependencies or method definitions are required, just modifications in the YAML step configuration.
-
Copy modified lines R61-R62 -
Copy modified lines R69-R70
| @@ -58,11 +58,13 @@ | ||
|
|
||
| - name: Release summary | ||
| shell: bash | ||
| env: | ||
| RELEASE_URL: ${{ steps.create-release.outputs.html_url }} | ||
| run: | | ||
| echo "🚀 **Release Created Successfully!**" | ||
| echo "📋 **Release Details:**" | ||
| echo " - Version: v${{ inputs.PACKAGE_VERSION }}" | ||
| echo " - Pre-release: ${{ inputs.PRE_RELEASE }}" | ||
| echo " - Build file: ${{ inputs.BUILD_ZIP_PATH }}" | ||
| echo " - Release URL: ${{ steps.create-release.outputs.html_url }}" | ||
| echo "RELEASE_URL=${{ steps.create-release.outputs.html_url }}" >> $GITHUB_ENV | ||
| echo " - Release URL: $RELEASE_URL" | ||
| echo "RELEASE_URL=$RELEASE_URL" >> $GITHUB_ENV |
| echo " - Pre-release: ${{ inputs.PRE_RELEASE }}" | ||
| echo " - Build file: ${{ inputs.BUILD_ZIP_PATH }}" | ||
| echo " - Release URL: ${{ steps.create-release.outputs.html_url }}" | ||
| echo "RELEASE_URL=${{ steps.create-release.outputs.html_url }}" >> $GITHUB_ENV |
Check warning
Code scanning / CodeQL
Code injection Medium
${ steps.create-release.outputs.html_url }
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To resolve the code injection risk, the workflow should avoid directly interpolating ${{ steps.create-release.outputs.html_url }} into the shell script. Instead, set it first as an environment variable via the env: field of the step, then reference it using standard shell variable syntax ($RELEASE_URL) when writing to $GITHUB_ENV. This change is limited to the "Release summary" step: define an environment variable RELEASE_URL set to ${{ steps.create-release.outputs.html_url }} in the step definition and then reference it as $RELEASE_URL within the shell script on line 68. No other lines need to be changed.
-
Copy modified lines R61-R62 -
Copy modified lines R69-R70
| @@ -58,11 +58,13 @@ | ||
|
|
||
| - name: Release summary | ||
| shell: bash | ||
| env: | ||
| RELEASE_URL: ${{ steps.create-release.outputs.html_url }} | ||
| run: | | ||
| echo "🚀 **Release Created Successfully!**" | ||
| echo "📋 **Release Details:**" | ||
| echo " - Version: v${{ inputs.PACKAGE_VERSION }}" | ||
| echo " - Pre-release: ${{ inputs.PRE_RELEASE }}" | ||
| echo " - Build file: ${{ inputs.BUILD_ZIP_PATH }}" | ||
| echo " - Release URL: ${{ steps.create-release.outputs.html_url }}" | ||
| echo "RELEASE_URL=${{ steps.create-release.outputs.html_url }}" >> $GITHUB_ENV | ||
| echo " - Release URL: $RELEASE_URL" | ||
| echo "RELEASE_URL=$RELEASE_URL" >> $GITHUB_ENV |
| - name: Create GitHub Release (Actual) | ||
| if: ${{ inputs.dry_run == false }} | ||
| id: create-release | ||
| uses: softprops/action-gh-release@v1 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step: create-release
2c69f3b to
cf085eb
Compare
- Add execute permissions to Hello Theme shell scripts - Resolves potential workflow execution issues - Standard best practice for .sh files in repositories Scripts updated: - commit-push-bump.sh - create-git-tag.sh - get-release-branch-name.sh - set-git-user.sh - sync-branches.sh
✨ PR Description
Purpose: Add Hello Elementor release workflow automation by cloning and adapting release preparation system from Hello Commerce.
Main changes:
Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using. We'd love your feedback! 🚀