T09 · Insecure Skill Coding Practices
- Location
references/SETUP.md:24- Finding
Credential File Is Created Without Enforcing Restrictive Permissions
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill performs the intended WeChat draft workflow, but it handles sensitive WeChat credentials and uploads content automatically with weak safeguards.
Review this before installing if the WeChat account matters. Store credentials with owner-only permissions, rotate secrets if they were exposed, confirm exactly which article and images will be uploaded before running it, and avoid opening fallback HTML generated from untrusted content. Expect it to create WeChat drafts, not fully publish articles, and do not rely on it for real Markdown conversion.
references/SETUP.md:24Credential File Is Created Without Enforcing Restrictive Permissions
scripts/test_config.py:48Configuration Diagnostics Disclose the AppSecret Suffix
scripts/publish.py:91Untrusted Article Content Is Written to an Executable HTML Fallback Without Sanitization
{digest}
整体主用途与声明大体一致,确实是在执行微信公众号草稿箱创建流程,并包含 token 获取、图片上传、草稿构建以及 fallback 生成。但描述有若干重要不准确之处。首先,描述说用户提供文章内容(Markdown),而代码没有 Markdown 转 HTML 的处理,仅支持把输入按 ||| 分割为标题/摘要/正文,并将正文按换行简单包成段落。其次,所谓“自动处理中文编码问题”并未真正实现编码转换或修复,只是在提交失败且错误码/错误信息看起来像编码问题时生成一个本地 HTML fallback 文件。再次,代码对资源输入有未声明的强假设:它依赖固定路径下的 credentials.json,并要求封面图必须存在于预设目录,正文配图也来自固定命名文件,而不是纯粹从用户提供的 Markdown 自动处理。因此描述与实际行为存在功能层面的偏差,足以判定为不匹配。
声明描述的是一个完整的微信公众号发布自动化技能,而实际代码仅用于测试本地配置是否正确,属于辅助/诊断脚本。它访问的资源主要是本地配置文件和图片目录,没有体现声明中的核心能力(内容接收、编码处理、调用微信 API、上传素材、创建草稿、发布文章、失败回退)。因此该代码片段与声明的主要用途存在明显且实质性的不一致。
The workflow explicitly checks for a local credentials.json and uses it to obtain an access token, meaning the skill accesses sensitive secrets from disk. Credential handling is inherently high risk because compromise, overbroad file access, or accidental invocation could expose app_id/app_secret and enable unauthorized API actions.
用户提供文章内容
↓
检查配置文件(credentials.json)
↓ 缺失 → 中断,提示用户配置
获取 access_token
↓ 失败 → 报错退出
The documentation specifies a fixed credential file path under the user's home directory containing AppID and AppSecret. Storing and reading secrets from a predictable plaintext location increases the risk of accidental disclosure, unauthorized reuse, and unsafe handling by other tools or users on the same system.
路径: ~/.openclaw/agents/gzh-assistant/wechat/credentials.json
模板:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# -*- coding: utf-8 -*-
"""
1-Click WOA - 微信公众号草稿箱一键发布脚本
读取 ~/.openclaw/agents/gzh-assistant/wechat/credentials.json 获取配置
"""
import requests
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# -*- coding: utf-8 -*-
"""
1-Click WOA - 微信公众号草稿箱一键发布脚本
读取 ~/.openclaw/agents/gzh-assistant/wechat/credentials.json 获取配置
"""
import requests
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# -*- coding: utf-8 -*-
"""
1-Click WOA - 微信公众号草稿箱一键发布脚本
读取 ~/.openclaw/agents/gzh-assistant/wechat/credentials.json 获取配置
"""
import requests
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# -*- coding: utf-8 -*-
"""
1-Click WOA - 微信公众号草稿箱一键发布脚本
读取 ~/.openclaw/agents/gzh-assistant/wechat/credentials.json 获取配置
"""
import requests
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# -*- coding: utf-8 -*-
"""
1-Click WOA - 微信公众号草稿箱一键发布脚本
读取 ~/.openclaw/agents/gzh-assistant/wechat/credentials.json 获取配置
"""
import requests
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# -*- coding: utf-8 -*-
"""
1-Click WOA - 微信公众号草稿箱一键发布脚本
读取 ~/.openclaw/agents/gzh-assistant/wechat/credentials.json 获取配置
"""
import requests
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# -*- coding: utf-8 -*-
"""
1-Click WOA - 微信公众号草稿箱一键发布脚本
读取 ~/.openclaw/agents/gzh-assistant/wechat/credentials.json 获取配置
"""
import requests
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# -*- coding: utf-8 -*-
"""
1-Click WOA - 微信公众号草稿箱一键发布脚本
读取 ~/.openclaw/agents/gzh-assistant/wechat/credentials.json 获取配置
"""
import requests
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# -*- coding: utf-8 -*-
"""
1-Click WOA - 微信公众号草稿箱一键发布脚本
读取 ~/.openclaw/agents/gzh-assistant/wechat/credentials.json 获取配置
"""
import requests
The skill describes reading local credentials, creating local files, and making outbound requests to WeChat, but it does not declare any explicit tool scope or permission boundaries. This weakens user awareness and platform enforcement, increasing the chance that sensitive files are read or data is transmitted without sufficiently explicit consent.
The trigger phrase '发草稿' is broad enough to match ordinary conversation, which can cause accidental invocation of a skill that reads credentials and may transmit content externally. In this context, ambiguous activation is riskier because the skill performs sensitive actions involving local secrets and outbound publishing.
The description does not clearly warn users that article content and images will be transmitted to the WeChat platform. This undermines informed consent for external data transfer, especially when user content may be sensitive or unpublished.
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
mkdir -p ~/.openclaw/agents/gzh-assistant/wechat
创建文件 ~/.openclaw/agents/gzh-assistant/wechat/credentials.json:
SQP-3 applies to all file types and includes language or locale policy violations. This troubleshooting guide forces Chinese-language interaction for all readers without any opt-in, alternative language option, or justification that the skill is region-specific.
The module documentation describes the script as a one-click publishing tool for WeChat draft-box articles. However, the code only calls the draft creation endpoint (/cgi-bin/draft/add) and then instructs the user to view the draft in the backend, which contradicts the stated 'publish' behavior.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
def get_access_token(app_id, app_secret):
"""获取 access_token"""
url = f"https://api.weixin.qq.com/cgi-bin/token"
params = {
"grant_type": "client_credential",
"appid": app_id,
This call uploads local image files to WeChat's material API. In a skill that reads file paths from local configuration, automatic file transmission can expose local assets without a user re-check, making this a genuine exfiltration risk if the configured directory contains unintended files or the skill is invoked unexpectedly.
with open(file_path, "rb") as f:
files = {"media": (filename, f, mime)}
url = f"https://api.weixin.qq.com/cgi-bin/material/add_material?access_token={access_token}&type={material_type}"
r = requests.post(url, files=files, timeout=30)
result = r.json()
if "media_id" in result:
This request transmits the assembled article body to WeChat's draft endpoint. Because the body is built from user input and local resources and then sent automatically, it creates a meaningful risk of unintended disclosure in an agent environment even though the endpoint itself is expected.
"""创建草稿"""
payload = {"articles": [article]}
headers = {"Content-Type": "application/json; charset=utf-8"}
url = f"https://api.weixin.qq.com/cgi-bin/draft/add?access_token={access_token}"
resp = requests.post(url, json=payload, headers=headers, timeout=15)
return resp.json()
This API call sends article content, metadata, and a media identifier to an external service. External transmission is expected for this skill, but in the agent context it is still security-relevant because the script performs the transfer automatically and may disclose sensitive user-provided content to WeChat without an explicit final approval step.
payload = {"articles": [article]}
headers = {"Content-Type": "application/json; charset=utf-8"}
url = f"https://api.weixin.qq.com/cgi-bin/draft/add?access_token={access_token}"
resp = requests.post(url, json=payload, headers=headers, timeout=15)
return resp.json()
The script automatically uploads local images and article content to remote WeChat APIs once invoked, without an interactive confirmation step or clear warning at the point of transmission. In an agent-skill context, this increases the risk of unintended exfiltration of sensitive text or files if the skill is triggered on the wrong content or with an unexpected image directory.
The manifest says users provide article content in Markdown and the skill will publish it, implying Markdown-aware handling. In code, the input is split on ||| and the body is only newline-wrapped into <p> tags, with no Markdown parsing for headings, links, lists, or images, so the implemented behavior does not match the advertised input format.