T09 · Insecure Skill Coding Practices
- Location
workflow.json:46- Finding
Untrusted Pull Request Content Is Directly Interpolated into an AI Prompt
- Content
View full analysis
Vulnerability Details
File Location:
workflow.json, lines 46–61
Vulnerability Type: Prompt injection through untrusted GitHub Pull Request content
Risk Level: MediumVulnerable Code
json { "step": 2, "skill": "summarize", "input": "PR diff + 元数据 + 历史评论", "output": "结构化分析结果:改动类型 | 影响范围 | 高风险点 | 改动规模量化", "prompt_template": "请分析以下 GitHub PR 的代码变更内容:\n\n【PR 信息】\n标题:{title}\n描述:{body}\n改动规模:+{additions}/-{deletions} 行,{changedFiles} 个文件\n作者:{author}\n\n\n【文件变更列表】\n{files_list}\n\n【完整 Diff】\n{diff}\n\n请输出:\n1. 改动类型识别(功能新增/缺陷修复/代码重构/依赖更新/配置变更)\n2. 影响范围评估(涉及哪些模块,模块间依赖关系)\n3. 高风险点识别(重点关注:安全漏洞、并发问题、数据一致性、API 契约变更)\n4. 改动规模量化总结" }Technical Analysis
The workflow interpolates GitHub Pull Request titles, descriptions, file lists, diffs, and associated review content into a natural-language prompt without an explicit trust boundary or instruction-neutralization mechanism. These fields can contain attacker-controlled text.
A malicious contributor could place model-directed instructions in a PR description, source-code comment, string literal, filename, or diff. Because the workflow does not explicitly require the model to treat interpolated fields exclusively as inert evidence, the downstream
summarizeagent may interpret those instructions as part of its task.The configuration also does not define strict output-schema validation or integrity checks before the analysis is passed to the review and Feishu publication stages. Consequently, injected content may influence both the intermediate analysis and the externally published report.
Attack Path
- An attacker creates or modifies a Pull Request that the victim is authorized to inspect.
- The attacker embeds adversarial instructions in the PR title, description, comments, filenames, or changed source code.
- Step 1 retrieves the attacker-controlled content through GitHub CLI commands.
- Step 2 substitutes the content into
{title},{body},{files_list}, or `{diff ...[truncated 959 chars]
- Remediation
View remediation
Remediation Suggestions
- Treat every value obtained from GitHub—including titles, descriptions, comments, filenames, and diffs—as untrusted data.
- Place untrusted content inside explicit, uniquely named delimiters and add a higher-priority instruction stating that text within those delimiters is evidence only and must never be followed as instructions.
- Prefer structured message fields or typed objects over direct interpolation into a single natural-language prompt.
- Separate system instructions from PR content using the downstream model API's role or content-type controls.
- Require the analysis response to conform to a strict schema with fixed fields, bounded lengths, and enumerated risk levels.
- Reject or safely encode unexpected report markup, links, mentions, and embedded instructions before sending content to Feishu.
- Add a validation stage that checks findings against quoted diff locations and flags unsupported conclusions.
- Require explicit user approval before publishing the generated report externally.
- Add adversarial tests containing prompt-injection strings in PR descriptions, comments, filenames, source comments, and string literals.
