Back to skill

Security audit

ai-pr-analysis-companion

Security checks for vulnerabilities and agentic risk

Overview

This PR review skill is coherent, but it can read full GitHub PR diffs and comments and automatically publish review reports to Feishu without clear approval, redaction, or containment controls.

Install only if you are comfortable granting the agent access to the target GitHub PR and publishing generated review content to Feishu. For private or sensitive repositories, require a preview/approval step, redact secrets and sensitive diffs, and confirm Feishu document permissions before use.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
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: Medium

Vulnerable 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 summarize agent 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

  1. An attacker creates or modifies a Pull Request that the victim is authorized to inspect.
  2. The attacker embeds adversarial instructions in the PR title, description, comments, filenames, or changed source code.
  3. Step 1 retrieves the attacker-controlled content through GitHub CLI commands.
  4. Step 2 substitutes the content into {title}, {body}, {files_list}, or `{diff ...[truncated 959 chars]
Remediation
View remediation

Remediation Suggestions

  1. Treat every value obtained from GitHub—including titles, descriptions, comments, filenames, and diffs—as untrusted data.
  2. 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.
  3. Prefer structured message fields or typed objects over direct interpolation into a single natural-language prompt.
  4. Separate system instructions from PR content using the downstream model API's role or content-type controls.
  5. Require the analysis response to conform to a strict schema with fixed fields, bounded lengths, and enumerated risk levels.
  6. Reject or safely encode unexpected report markup, links, mentions, and embedded instructions before sending content to Feishu.
  7. Add a validation stage that checks findings against quoted diff locations and flags unsupported conclusions.
  8. Require explicit user approval before publishing the generated report externally.
  9. Add adversarial tests containing prompt-injection strings in PR descriptions, comments, filenames, source comments, and string literals.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (8)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The README explicitly describes automatically generating and publishing PR review reports to Feishu, but it does not mention consent, redaction, approval, or safeguards for sensitive repository data. Because PR metadata, diffs, comments, and review findings can contain proprietary code, secrets, or internal context, sending them to an external collaboration platform can cause unintended data exposure.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The trigger phrases are broad and overlap with common review terminology such as PR review and code analysis, which can cause unintended invocation in contexts the user did not explicitly intend. In a skill that pulls repository data and publishes reports externally, accidental activation increases the chance of unnecessary access to code diffs and downstream disclosure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly describes sending PR analysis results to Feishu but does not warn users that repository content, summaries, or sensitive findings may be transmitted to an external service. This creates a real data handling and confidentiality risk, especially for private repositories, internal code, or security-sensitive review comments.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The workflow retrieves private PR metadata, full diffs, and historical comments, which may contain proprietary code, secrets, incident details, or reviewer discussions, yet no privacy or minimization warning is provided. Because the same workflow later generates and publishes a report externally, the lack of explicit safeguards materially increases the risk of oversharing sensitive repository information.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

All user-facing natural-language descriptions, prompts, section names, and trigger phrases are provided only in Chinese, with no indication that users may choose another language. Under the language/locale policy, a skill should not impose a specific language unless the constraint is clearly documented and justified or the user is offered a choice.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases are broad, generic software-development terms like '代码审查', 'PR评审', and '分析PR', which are likely to match ordinary user conversations and invoke the skill unintentionally. In this skill, accidental invocation can cause collection of GitHub PR metadata, diffs, and comments and subsequent publication to Feishu, creating unnecessary data exposure and unintended automation side effects.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The natural-language interface, examples, and operational descriptions are all presented in Chinese, with no note that other languages are supported or that Chinese is an intentional locale-specific constraint. This can be a language/locale policy concern when a skill effectively forces one language without documenting user choice or justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

Natural-language instructions, triggers, and examples are all presented in Chinese, which effectively imposes a specific language for use of the skill. There is no indication that this is an opt-in locale choice or that the skill is intentionally limited to a Chinese-speaking environment.

Content

No source excerpt is available for this finding.