Skip to content

[plan] Fix high-severity template injection in cloclo.md #5753

Description

@github-actions

Objective

Fix the HIGH severity template injection vulnerability in .github/workflows/cloclo.md by replacing envsubst with safe in-place string substitution.

Context

The cloclo.md workflow uses envsubst on potentially untrusted data from ${{ needs.activation.outputs.text }}, creating a code injection vulnerability. This is marked as HIGH severity in the static analysis.

Current Vulnerable Pattern

env:
  GH_AW_NEEDS_ACTIVATION_OUTPUTS_TEXT: ${{ needs.activation.outputs.text }}
run: |
  cat << 'PROMPT_EOF' | envsubst > "$GH_AW_PROMPT"
  [template content with $GH_AW_NEEDS_ACTIVATION_OUTPUTS_TEXT]
  PROMPT_EOF

Required Changes

  1. Replace the envsubst pattern with sed-based substitution:
env:
  GH_AW_NEEDS_ACTIVATION_OUTPUTS_TEXT: ${{ needs.activation.outputs.text }}
run: |
  # Write template with placeholder directly to target file
  cat << 'PROMPT_EOF' > "$GH_AW_PROMPT"
  [template content with __GH_AW_NEEDS_ACTIVATION_OUTPUTS_TEXT__]
  PROMPT_EOF
  
  # Safely substitute using sed (escapes pipe character to avoid delimiter conflicts)
  sed -i "s|__GH_AW_NEEDS_ACTIVATION_OUTPUTS_TEXT__|${GH_AW_NEEDS_ACTIVATION_OUTPUTS_TEXT//|/\\|}|g" "$GH_AW_PROMPT"
  1. Replace all $VAR references in the template with __VAR__ placeholders
  2. Recompile the workflow: make recompile

Files to Modify

  • .github/workflows/cloclo.md

Testing

Test the fix with malicious-looking input:

# Test content with shell metacharacters: $, `, \, $(), etc.
echo "Test: \$(malicious_command) and \`backdoor\` and \${VAR}"

Verify:

  • Content is treated as literal text (not expanded)
  • Workflow completes successfully
  • Output contains the literal special characters
  • No shell expansion occurs

Acceptance Criteria

AI generated by Plan Command for discussion #5735

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions