Skip to content

[task] Fix template injection risks in mcp-inspector.md and copilot-session-insights.md #3984

@github-actions

Description

@github-actions

Objective

Review and fix potential template injection vulnerabilities in two workflows where untrusted data may flow into template expressions.

Context

Static analysis identified potential code injection risks via template expansion at:

  1. mcp-inspector.md (line 1130) - "Setup MCPs" step name
  2. copilot-session-insights.md (line 205) - continue-on-error directive

While marked as LOW severity, this could escalate if combined with other vulnerabilities.

From discussion #3945 (Static Analysis Report - November 14, 2025).

Approach

  1. Review the template expressions at the identified lines
  2. Trace data flow to determine if untrusted user input is interpolated
  3. If untrusted data is used, sanitize it before template expansion
  4. Use environment variables or intermediate steps as needed
  5. Ensure no GitHub context variables containing user input are used directly in expressions

Files to Modify

  • .github/workflows/mcp-inspector.md (line 1130)
  • .github/workflows/copilot-session-insights.md (line 205)

Security Best Practices

  • Never use ${{ github.event.issue.title }}, ${{ github.event.issue.body }}, or similar untrusted inputs directly
  • Use needs.activation.outputs.text for sanitized context instead
  • Pass untrusted data through environment variables
  • Validate and sanitize inputs before use

Acceptance Criteria

  • Template expressions at mcp-inspector.md:1130 reviewed
  • Template expressions at copilot-session-insights.md:205 reviewed
  • No untrusted user input flows into template expressions
  • Environment variables or sanitization used where needed
  • Both workflows compile successfully
  • Functionality preserved after changes
  • Documentation added explaining the security consideration

Security Impact

Prevents potential code injection attacks via template expansion, especially important for workflows processing public repository content.

Estimated Effort

2 hours

AI generated by Plan Command for discussion #3945

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions