T09 · Insecure Skill Coding Practices
- Location
scripts/generate_prd.py:124- Finding
Path Traversal Through an Unvalidated Default Output Filename
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a disclosed PRD template generator with optional Feishu publishing, with manageable file-output and template-guidance risks.
Install only if a Chinese-language PRD generator fits your workflow. Use trusted JSON inputs, provide explicit safe output filenames/directories, avoid overwriting existing files, and review/redact generated PRDs before using the Feishu upload flow. For API PRDs, replace the default WebSocket query-token guidance with a safer authentication pattern before implementation.
scripts/generate_prd.py:124Path Traversal Through an Unvalidated Default Output Filename
templates/prd/api-prd.md:521API Template Recommends Passing Authentication Tokens in URL Query Parameters
Referenced artifact was not completely inspected
| API 设计 PRD | `api-prd.md` | 接口/API 设计 |
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
| POST | 创建资源 | ❌ | {{post_ex|default('POST /users')}} |
| PUT | 全量更新 | ✅ | {{put_ex|default('PUT /users/123')}} |
| PATCH | 部分更新 | ✅ | {{patch_ex|default('PATCH /users/123')}} |
| DELETE | 删除资源 | ✅ | {{delete_ex|default('DELETE /users/123')}} |
### 3.4 状态码规范
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
| 方式 | 适用场景 | 说明 |
|------|----------|------|
| {{auth_type_1|default('OAuth 2.0')}} | {{auth_scene_1|default('第三方应用接入')}} | {{auth_desc_1|default('标准 OAuth 流程,支持 Authorization Code 模式')}} |
| {{auth_type_2|default('JWT')}} | {{auth_scene_2|default('内部服务/前端应用')}} | {{auth_desc_2|default('Access Token + Refresh Token 机制')}} |
| {{auth_type_3|default('API Key')}} | {{auth_scene_3|default('服务器间调用')}} | {{auth_desc_3|default('Header 中携带 X-API-Key')}} |
#### 3.6.2 JWT Token 规范
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
| 方式 | 适用场景 | 说明 |
|------|----------|------|
| {{auth_type_1|default('OAuth 2.0')}} | {{auth_scene_1|default('第三方应用接入')}} | {{auth_desc_1|default('标准 OAuth 流程,支持 Authorization Code 模式')}} |
| {{auth_type_2|default('JWT')}} | {{auth_scene_2|default('内部服务/前端应用')}} | {{auth_desc_2|default('Access Token + Refresh Token 机制')}} |
| {{auth_type_3|default('API Key')}} | {{auth_scene_3|default('服务器间调用')}} | {{auth_desc_3|default('Header 中携带 X-API-Key')}} |
#### 3.6.2 JWT Token 规范
The skill explicitly promotes generating and uploading PRD content to Feishu, but it does not warn users that the generated document content may contain sensitive internal business data, prompts, API details, or other confidential information before external transmission. This creates a real data exfiltration risk because users may invoke the upload flow without understanding that local/project data is being sent to a third-party platform.
The class and method documentation describe a Feishu document integration that 'creates Feishu documents' and returns a creation result with a document URL. However, the actual implementation only checks for module availability and returns a placeholder response instructing the caller to use another tool, with no creation call or URL produced.
render_to_file writes rendered content to any caller-supplied path with no path validation or restriction. In an agent or automation context, if an attacker can influence output_path, this can overwrite arbitrary files accessible to the process, leading to data loss, tampering, or placement of attacker-controlled content in sensitive locations.
The entire template, including its default system prompt and user-facing text examples, is written only in Chinese and does not indicate that language selection is optional or region-specific. This creates a natural-language policy concern because it effectively forces a specific language/locale without user opt-in or justification.
The template explicitly defines a degraded state as a 'silent switch' to a fallback path, which can hide from users that AI behavior, quality, or guarantees have changed. In an AI product PRD, this is risky because degraded operation may alter accuracy, safety controls, or provenance without user awareness, leading to misplaced trust and unsafe downstream decisions.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
{{base_url|default('https://api.example.com/v{version}/{resource}/{action}')}}
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
{{base_url|default('https://api.example.com/v{version}/{resource}/{action}')}}
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
{{base_url|default('https://api.example.com/v{version}/{resource}/{action}')}}
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
{{base_url|default('https://api.example.com/v{version}/{resource}/{action}')}}
The template recommends passing a WebSocket token in the query string, which risks credential exposure through browser history, intermediary logs, reverse proxies, analytics tooling, and referrer-like operational traces. Because this is a PRD template, downstream teams may implement this pattern directly, propagating insecure authentication design into production systems.
The document title and the full template content are presented in Chinese, which imposes a specific language on users by default. The file does not indicate that Chinese is optional, user-selected, or required for a region-specific purpose, so it appears to violate the language/locale choice policy.
The document title and the entire template content are written in Chinese, which effectively imposes a specific language on skill output. The file does not indicate that Chinese is optional, user-selectable, or required for a documented region-specific purpose, so it conflicts with the language/locale policy criteria.
The file’s natural-language descriptions are entirely Chinese, including the module purpose and user-facing terminology, with no indication that language choice is configurable or limited to a justified region-specific use case. Per the policy, forcing a specific language without user opt-in is a locale/language policy concern.
The docstring at L115 says the method extracts 'all' placeholder variables from the template, but the regex at L127 only captures simple {{ variable }} patterns. It will miss dotted names, indexed expressions, filters, function calls, control-structure variables, and many valid Jinja2 constructs, so the documented intent overstates actual behavior.
The entire PRD template is written in Chinese, including headings, field descriptions, and examples, with no indication that language selection is optional. Under the policy rule, a skill or template that enforces a specific language without user opt-in can violate locale/language requirements.
The title and the entire PRD template are written in Chinese, which imposes a specific language by default. Under the policy for natural-language violations, forcing a locale or language without user opt-in should be flagged unless the regional constraint is clearly documented and justified, which is not present here.