Back to skill

Security audit

配置拉取代码生成

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent code-generation purpose, but it needs review because it requires writing generated app code into the workspace without clear safeguards for confirmation, overwrites, or unsafe template values.

Install only if you expect this skill to modify an Android project. Review generated diffs before keeping them, avoid using untrusted names, keys, URLs, or JSON fields as inputs, and validate or escape template values before compiling generated code.

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

Error
Location
references/config-center-template.md:10
Finding
Unvalidated Template Interpolation Enables Kotlin Source-Code Injection<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:48-49`; `references/api-template.md:43`; `references/config-center-template.md:10-13`; `references/push-pull-template.md:10-11`; `references/whitelist-template.md:9` **Vulnerability Type**: Source-code injection through unsafe template interpolation **Risk Level**: High The Skill requires generated code to be written into the user's workspace: ```markdown - 代码优先使用 Kotlin 编写 - 数据模型如果跟网络相关需要添加 `@Keep` 注解 - **生成代码后,必须写入到 workspace 对应文件,并展示给用户看** ``` Multiple user-controlled values are inserted directly into Kotlin source-code templates without escaping, validation, or identifier normalization. `references/api-template.md:43`: ```kotlin public interface {Name}Service { @POST("{apiUrl}") Observable<{Name}Response> query{Name}Config(@Body {Name}Request request); } ``` `references/config-center-template.md:10-13`: ```kotlin private const val CONFIG_KEY_CONFIG_VERSION = "1.0.0" private const val CONFIG_KEY_YZ_HD_{NAME}_CONFIG = "{componentKey}" private const val TAG = "{Name}ConfigManager" private const val CONFIG_KEY_YZ_HD_{NAME}_CONFIG_KEY = "{fieldKey}" ``` `references/push-pull-template.md:10-11`: ```kotlin private const val PUSH_KEY = "{pushKey}" private const val PULL_URL = "{pullUrl}" ``` `references/whitelist-template.md:9`: ```kotlin WhiteListTask.isInWhiteList({key}).subscribe({ result -> // TODO 待实现 }, { error -> // TODO 待实现 }) ``` ### Technical Analysis The placeholders include configuration names, JSON-derived field names, API URLs, component keys, field keys, push keys, pull URLs, and whitelist keys. These values can enter either: 1. **Kotlin string-literal contexts**, such as `"{componentKey}"` and `"{pullUrl}"`; or 2. **Kotlin identifier contexts**, such as `{Name}`, `{NAME}`, method names, class names, and generated JSON property names. No instruction requires escaping Kotlin string literals, rejecting line breaks or control characters, validating identifiers ...[truncated 2393 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Validate generated identifiers** - Permit identifiers only when they match a strict pattern such as `^[A-Za-z_][A-Za-z0-9_]*$`. - Apply the same validation after capitalization, case conversion, or other name transformations. - Reject Kotlin and Java reserved words or map them to explicitly safe alternatives. - Never derive declarations directly from arbitrary JSON property names. 2. **Escape string literals with a dedicated encoder** - Encode quotation marks, backslashes, carriage returns, line feeds, tabs, Unicode separators, and control characters before inserting values into Kotlin or Java literals. - Do not rely on manual replacement or Markdown formatting. - Prefer a tested code-generation library that builds language syntax trees rather than concatenating strings. 3. **Validate keys and URLs** - Define restrictive character and length allowlists for component, field, push, and whitelist keys. - Parse URLs or API paths before generation. - Permit only expected schemes, hosts, path formats, and API versions. - Reject embedded whitespace, comments, quotation marks, newlines, and delimiter characters. 4. **Validate template JSON** - Parse supplied JSON with a strict parser. - Enforce an explicit schema, nesting-depth limit, field-count limit, and maximum input size. - Map JSON properties to safe generated identifiers rather than using property names verbatim. - Reject unsupported property types and duplicate or ambiguous normalized names. 5. **Introduce a safe write workflow** - Generate files in memory first. - Present an exact diff and destination paths to the user. - Require explicit confirmation before modifying existing workspace files. - Prevent path traversal and ensure every destination remains under the intended module directory. - Avoid silently overwriting existing managers or plugin modules. 6. **Add adversarial tests** - Test inputs containi ...[truncated 302 chars]
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (9)

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill explicitly instructs the agent to write generated code directly into workspace files without requiring explicit user confirmation or warning that local files will be modified. In an agent setting, this creates an unsafe side effect boundary: a user may believe they are only requesting a template, while the skill performs file mutations that could overwrite existing code or introduce unintended changes.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
This repeated requirement reinforces mandatory workspace modification as part of normal execution, again without any user warning or consent step. Repetition increases the chance the agent treats file writes as compulsory behavior, making accidental or unauthorized project changes more likely in a real development workspace.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The file’s instructional content and examples are presented in Chinese only, beginning with the title and continuing through the usage guidance. Under the policy, forcing a specific language without user opt-in or documented justification is a natural-language policy violation.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
L087-L142 声称是“完整示例”,但 `ActivityRefreshUtils` 中定义的是 `registerMemberPriceNotification()`,回调里又调用 `MemberPriceConfigManager.saveActivityConfig(...)` 和 `queryOfflineMemberPriceConfig()`。这使示例文档对“该模板生成何种配置拉取/推送代码”的开发者意图产生直接冲突,属于注释/文档与代码示例行为不一致。

Natural-Language Policy Violations

Medium
Confidence
88% confidence
Finding
The document’s instructional content is written in Chinese and does not indicate that language selection is optional or that the template is intended only for a Chinese-speaking or region-specific context. This can violate language/locale policy when a skill implicitly forces one language without user opt-in.

Natural-Language Policy Violations

Low
Confidence
89% confidence
Finding
The file’s user-facing headings and instructions are entirely in Chinese, such as the title and usage notes, with no indication that other languages are supported. This can violate a language/locale policy when a skill or template imposes a specific language without user opt-in.

Natural-Language Policy Violations

Low
Confidence
92% confidence
Finding
The natural-language instructions and headings are presented only in Chinese, which can amount to a language policy violation when no user opt-in or locale limitation is stated. There is no indication that the skill is intended exclusively for a Chinese-speaking or region-specific context.

Missing User Warnings

Low
Confidence
79% confidence
Finding
This markdown file explains generating a configuration manager with push notification registration logic, which implies remote communication and automatic configuration updates. The description and usage notes do not warn that the skill/template performs network-backed config pulls/push-triggered refreshes that may affect application behavior or data handling.

Intent-Code Divergence

Low
Confidence
90% confidence
Finding
L068-L082 标注为“对应的 Manager 示例”,但示例中的函数命名和参数类型前后不一致:`MemberPriceConfigManager` 暴露 `queryOfflineMemberPriceConfig()`,却又提供 `saveActivityConfig(config: ActivityConfig)`。这不是单纯信息缺失,而是文档示例主动把 MemberPrice 与 Activity 两种不同配置意图混在一起,和其宣称的 manager 对应关系相矛盾。

Static analysis

No suspicious patterns detected.