fix: prevent template injection in webhook_image workflow#3101
Merged
wainersm merged 1 commit intoJun 1, 2026
Conversation
mkulke
reviewed
May 27, 2026
mkulke
left a comment
Collaborator
There was a problem hiding this comment.
thanks for addressing this, could we also make sure workflow is checked by the existing zizmor ci jobs? we seem to have a gap here.
Move template expressions to environment variables to fix 3 template
injection vulnerabilities identified by zizmor security audit.
- Add env block with IMAGE_TAGS and REGISTRY variables
- Replace direct ${{ inputs.* }} usage with environment variable references
Reference: https://docs.zizmor.sh/audits/#template-injection
Signed-off-by: Rafsal-Rahim <rafsal.rahim@ibm.com>
rafsal-rahim
force-pushed
the
zizmor-check-v1
branch
from
May 29, 2026 05:32
ea24803 to
7aca5e9
Compare
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.
This PR fixes 3 template injection vulnerabilities in the webhook_image.yaml workflow identified by the zizmor security audit tool.
Problem
The workflow was directly interpolating user-controlled inputs (inputs.image_tags and inputs.registry) into shell commands without proper sanitization. This creates a security risk where malicious input containing shell metacharacters could potentially be used for command injection attacks.
Vulnerable code locations:
Line 76: tags="${{ inputs.image_tags }}" - Direct interpolation in shell variable
Line 83: IMG="${{ inputs.registry }}/peer-pods-webhook:${t}" - Direct interpolation in make command
Line 89: IMG=${{ inputs.registry }}/peer-pods-webhook:latest - Direct interpolation in make command
Solution
Following GitHub Actions security best practices, all template expressions have been moved to environment variables in the env: block. GitHub Actions automatically escapes environment variable values, preventing injection attacks.
Changes made:
Added env: block to the "Build and push image" step with:
IMAGE_TAGS: ${{ inputs.image_tags }}
REGISTRY: ${{ inputs.registry }}
Replaced all direct template expressions with environment variable references:
${{ inputs.image_tags }} → ${IMAGE_TAGS}
${{ inputs.registry }} → ${REGISTRY}
Testing
Workflow syntax is valid
No functional changes to the workflow behavior
Security vulnerabilities are resolved
References
Zizmor Documentation: https://docs.zizmor.sh/audits/#template-injection
Security Impact
This change eliminates potential command injection vulnerabilities while maintaining the same functionality. The workflow will continue to work exactly as before, but with improved security posture.
Created with help of Bob