[WIP] Fix template injection in single-instance workflows #6617
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.
Fix Template Injection in Single-Instance Workflows
Status: ✅ ALREADY FIXED - Issue Can Be Closed
Investigation Complete
After thorough investigation, all three workflows mentioned in this issue have already been fixed and are using safe JavaScript-based placeholder substitution instead of
envsubst.Workflows Verified
substitutePlaceholderswith safe__VAR__placeholderssubstitutePlaceholderswith safe__VAR__placeholderssubstitutePlaceholderswith safe__VAR__placeholdersHow The Fix Works
The fix was implemented at the compiler level in PR #5773 (merged Dec 7, 2025):
1. Compiler Changes (
pkg/workflow/compiler_yaml.go):generatePlaceholderSubstitutionStep()generates safe JavaScript substitution${{ expressions }}to__VAR__placeholders in templatessubstitute_placeholders.cjsscript inline in generated workflows2. Safe Substitution Script (
pkg/workflow/js/substitute_placeholders.cjs):.split()and.join()- no regex, no shell expansion3. Generated Workflow Pattern:
Verification Results
✅ No envsubst found:
find .github/workflows -name "*.lock.yml" -exec grep -l "envsubst" {} \;returns empty✅ All workflows use substitutePlaceholders: Verified in all three workflow .lock.yml files
✅ Compiler generates safe code: Function
generatePlaceholderSubstitutionStep()automatically applied✅ No template injection patterns: No unsafe
${{ }}expansion in run scriptsTimeline
Recommendation
This issue should be closed as resolved. The vulnerability has been completely mitigated by the compiler-level fix in PR #5773, which automatically generates safe code for all workflows.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.