T09 · Insecure Skill Coding Practices
- Location
workflow.json:65- Finding
Indirect Prompt Injection Through Untrusted Pull Request Content
- Content
View full analysis
Vulnerability Details
File Location:
workflow.json, lines 65-77
Vulnerability Type: Indirect prompt injection caused by unsafe interpolation of untrusted content
Risk Level: HighVulnerable Code
json "inputs": { "pr_title": "{{steps.1.pr_title}}", "pr_description": "{{steps.1.pr_description}}", "diff_content": "{{steps.1.diff_content}}", "files_changed": "{{steps.1.files_changed}}", "context": "{{inputs.context}}" }, "prompt_template": "你是一位资深软件架构师。请分析以下 Pull Request 的代码变更:\n\n## PR 信息\n标题:{pr_title}\n描述:{pr_description}\n作者:{pr_author}\n标签:{pr_labels}\n\n## 代码变更(Diff)\n{diff_content}\n\n## 涉及文件\n{files_changed}\n\n请分析并输出:\n1. **功能分类**:这是新功能 / Bug修复 / 重构 / 性能优化 / 文档更新 / 安全修复?\n2. **核心变更**:用1-2句话通俗描述这次变更做了什么\n3. **技术亮点**:关键技术实现或设计决策\n4. **破坏性变更**:是否有破坏性变更?如有,说明需要什么迁移\n5. **测试覆盖**:测试是否充分?需要手动验证的点\n6. **影响范围**:哪些模块/功能受影响?", "outputs": [ "change_category", "one_sentence_summary", "technical_highlights", "breaking_changes", "migration_guide", "test_notes", "impact_scope" ]Technical Analysis
Pull request titles, descriptions, file names, and diff contents may be controlled by an untrusted pull request author. The workflow interpolates these values directly into an instruction-bearing AI prompt without applying structural isolation, escaping, content filtering, or an explicit rule that instructions found inside pull request data must not be followed.
A malicious contributor can place prompt-like directives in a pull request description, source-code comment, string literal, file name, or other diff content. Because this content appears in the same prompt context as the workflow's legitimate instructions, the model may interpret the embedded text as additional instructions rather than data to analyze.
The workflow also forwards the resulting analysis into subsequent summarization and publication steps. Consequently, successful injection can propagate attac ...[truncated 1568 chars]
- Remediation
View remediation
Remediation Suggestions
- Treat all GitHub-derived values as untrusted data, including titles, descriptions, comments, labels, file names, and diff contents.
- Place untrusted content in clearly delimited structured fields rather than concatenating it into the main instruction text.
- Add a high-priority instruction stating that content inside the pull request is data only and that any instructions found within it must be ignored.
- Use a strict output schema with fixed field types, length limits, and allowed values. Reject output that does not conform.
- Add a second validation stage that checks whether conclusions are supported by the retrieved diff instead of blindly forwarding model output.
- Sanitize generated Markdown, URLs, mentions, and embedded content before publication.
- Require human review before publishing reports generated from untrusted or externally authored pull requests.
- Consider processing large diffs in isolated chunks and labeling every chunk as untrusted source material.
