fix: DEVPLAT-7883 prevent shell injection in Set fields step#25
Merged
Conversation
Move `${{ github.* }}` and `${{ inputs.* }}` interpolations out of the
`run:` shell block into the step-level `env:` block and reference them
as `"$VAR"`. Uses the built-in `$GITHUB_SHA` env var for `github.sha`.
Addresses the Semgrep finding of
yaml.github-actions.security.run-shell-injection.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
e0e5b86 to
687700a
Compare
kristianmills
commented
May 19, 2026
| status: ${{ inputs.status }} | ||
| repository: ${{ inputs.repository }} | ||
| event_pusher_name: ${{ github.event.pusher.name }} | ||
| event_sender_login: ${{ github.event.sender.login }} |
Contributor
Author
There was a problem hiding this comment.
other scribd org repos typically use all caps for env variables, however this repo already uses lowercase so I decided to match what was already here.
Contributor
Author
There was a problem hiding this comment.
I could see an argument for changing it, since I think its a lot easier to parse capitalized variables out of strings eg: message="https://github.com/$repository/commit/$github_sha|$commit_message" vs message="https://github.com/$REPOSITORY/commit/$GITHUB_SHA|$COMMIT_MESSAGE"
Member
There was a problem hiding this comment.
Yes, we need to fix that and capitalize the environment variable names to follow the standard naming conventions (https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap08.html).
kamranf
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves DEVPLAT-7883 — Semgrep finding of
yaml.github-actions.security.run-shell-injectionin the "Set fields" step.Moves all
${{ github.* }}and${{ inputs.* }}interpolations out of therun:shell block into the step-levelenv:block, then references them as quoted shell variables. Uses the runner-provided$GITHUB_SHAinstead of redeclaringgithub.sha.Variables moved into
env:status: ${{ inputs.status }}repository: ${{ inputs.repository }}event_pusher_name: ${{ github.event.pusher.name }}event_sender_login: ${{ github.event.sender.login }}(
input_messageandcommit_messagewere already done correctly.)Notes
${author:-$event_sender_login}in bash works the same as${author:-${{ github.event.sender.login }}}after the template substitution)."$input_message","${author:-$event_sender_login}") where the original was unquoted; safe because none of these values can legitimately contain spaces or shell metachars.Test plan
pushevent — verify Slack notification has the right emoji, color, author, and commit-linkworkflow_dispatch— verify author falls back tosender.loginand commit message is pulled fromgit logReferences:
🤖 Generated with Claude Code
Note
Low Risk
Low risk: change is limited to how the composite action passes GitHub/inputs values into the bash script (via
env+ quoting), intended to reduce shell-injection risk while keeping notification behavior the same.Overview
Hardens the
Set fieldsbash step inaction.ymlby moving${{ inputs.* }}/${{ github.* }}interpolations into step-levelenvvariables and referencing them as quoted shell variables.Commit-link construction is updated to use
$GITHUB_SHAand$repository, and author selection now uses$event_pusher_namewith a$event_sender_loginfallback, reducing exposure to run-script injection without changing the Slack payload structure.Reviewed by Cursor Bugbot for commit 687700a. Bugbot is set up for automated code reviews on this repo. Configure here.