Skip to content

Potential fix for code scanning alert no. 19: Code injection#117

Merged
anoncam merged 1 commit intomainfrom
alert-autofix-19
Feb 28, 2026
Merged

Potential fix for code scanning alert no. 19: Code injection#117
anoncam merged 1 commit intomainfrom
alert-autofix-19

Conversation

@anoncam
Copy link
Owner

@anoncam anoncam commented Feb 28, 2026

Potential fix for https://github.com/anoncam/dedpaste/security/code-scanning/19

General fix: avoid using ${{ ... }} expressions containing untrusted input directly inside run: scripts. Instead, map the expression to an environment variable at the step level (env:), and then reference that variable using native shell syntax ($VAR) inside the script. This prevents GitHub expression syntax from appearing in the script content itself, which is what CodeQL flags.

Concrete fix here:

  • In the “Release complete” step (lines 556–561), we currently embed ${{ steps.version.outputs.version }} inside the shell script.
  • We should:
    • Add an env: section to that step, defining something like RELEASE_VERSION: ${{ steps.version.outputs.version }}.
    • Update the echo line to use $RELEASE_VERSION instead of ${{ steps.version.outputs.version }}.
  • This preserves the existing functionality (printing the same version string) while conforming to the safe pattern and satisfying CodeQL.

Only .github/workflows/release-with-sbom.yml is affected, and no new imports or external tools are required.


Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@anoncam anoncam self-assigned this Feb 28, 2026
@anoncam anoncam marked this pull request as ready for review February 28, 2026 00:45
@anoncam anoncam requested a review from Copilot February 28, 2026 00:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to address GitHub code scanning alert #19 (code injection) by removing direct ${{ ... }} GitHub expression interpolation from within a run: shell script in the release workflow.

Changes:

  • Adds a step-level env: mapping for the release version in the “Release complete” step.
  • Updates the version echo statement to use native shell variable expansion ($RELEASE_VERSION) instead of ${{ ... }}.

echo "✅ Release process complete"
echo "Version: v${{ steps.version.outputs.version }}"
echo "Version: v$RELEASE_VERSION"
echo "Release URL: ${{ steps.create_release.outputs.url }}"
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The run: script still embeds a GitHub expression in echo "Release URL: ${{ steps.create_release.outputs.url }}". If this change is intended to address the CodeQL code-injection alert by eliminating ${{ ... }} inside shell scripts, this line should follow the same pattern (map the expression to a step-level env: var and reference it via shell syntax) or the alert may persist.

Copilot uses AI. Check for mistakes.
Copy link
Owner Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

@anoncam
Copy link
Owner Author

anoncam commented Feb 28, 2026

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Feb 28, 2026

@anoncam I've opened a new pull request, #118, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Feb 28, 2026

@anoncam I've opened a new pull request, #119, to work on those changes. Once the pull request is ready, I'll request review from you.

@anoncam anoncam merged commit 13faa36 into main Feb 28, 2026
7 checks passed
github-actions bot added a commit that referenced this pull request Feb 28, 2026
Version bump type: patch
PR: #117
Title: Potential fix for code scanning alert no. 19: Code injection
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