T09 · Insecure Skill Coding Practices
- Location
test_system.py:146- Finding
Test Suite Modifies and Can Erase Production Medication Records
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This medication reminder skill is mostly local and purpose-aligned, but it needs Review because its tests can alter real medication records and its metadata grants broad command execution authority.
Before installing, review or remove execute_command permission, avoid running test_system.py or test_system.py --cleanup against your real profile, and treat all records and CSV exports as sensitive health data stored under ~/.openclaw/medication_data. Expect to configure reminders manually unless the OpenClaw cron integration is completed and scoped.
test_system.py:146Test Suite Modifies and Can Erase Production Medication Records
The code generally matches the medication-tracking, statistics, and data-export aspects of the description. It stores records, computes adherence metrics, generates reports, and exports CSV data. However, the key advertised capability—automatic daily 6:30 reminders—is not actually implemented in this code chunk. There is no scheduler, cron integration, background loop, system notification call, or messaging trigger; only a function that generates reminder text. This is a material description-to-behavior mismatch because the primary reminder behavior is presented as active/automatic, while the code is mainly a local record/report CLI tool with configurable reminder settings but no execution mechanism for reminders.
总体上代码与“优甲乐服药提醒、统计、数据导出”这一核心用途大体相关,但声明并不完全准确。代码不仅做每日提醒,还实现了完整的命令驱动型交互系统,包括启停提醒、手动/当前时间记录服药、状态查询、报告生成、记录浏览、设置查看、测试提醒,以及命令行入口 __main__ 与外部命令处理函数 handle_medication_command。此外,帮助文本明确说明数据会存储在本地目录 ~/.openclaw/medication_data/,这属于持久化能力,声明中未提及。最明显的不一致是声明的触发器为空,而代码实际围绕命令触发运行。因此应判定为存在描述与行为不完全匹配。
Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.
tail -f /tmp/openclaw/openclaw-*.log
ls -la ~/.openclaw/medication_data/
## 📈 统计指标说明
The skill declares capabilities that imply file read/write and shell-backed behavior, but it does not explicitly scope or constrain those tools in the manifest. In a health-related skill that persists medication data, missing tool/permission declarations weakens the trust boundary and can allow broader-than-expected local file or command access if the runtime grants defaults.
The skill handles sensitive health and medication-adherence data and states that it automatically creates persistent local data files, but it does not present a clear warning or consent-oriented disclosure to users. In a medical context, silent local persistence increases privacy risk because users may not realize protected health information is being stored and retained on disk.
The guide encourages exporting medication records and sharing them with a doctor, but it does not warn that these records are sensitive health data. Users may export files to insecure locations or transmit them through unencrypted channels, increasing the chance of unintended disclosure of personal medical information.
The trigger word "甲状腺" is a broad medical topic rather than a specific invocation phrase. Mentioning thyroid-related issues in ordinary health discussion could unintentionally match this skill without clearly signaling a reminder or medication-tracking intent.
The manifest grants execute_command to a medication reminder and record-tracking skill even though the stated functionality only requires reminders, file I/O, and report generation. Unnecessary shell access materially expands the attack surface: if any downstream prompt, file content, or user-controlled data reaches command execution, the skill could run arbitrary OS commands, exposing or altering local data.
The module docstring and function docstring indicate the skill generates reminder messages in Chinese, and the fallback reminder strings are also only in Chinese. For an all-file-types policy check, this is a natural-language locale restriction with no user opt-in or documented justification that the skill is region- or language-specific.
The file-level description and all user-facing strings are written exclusively in Chinese, indicating the skill is designed to operate in a single language without any user opt-in or language selection mechanism. This matches a natural-language policy concern because the skill implicitly forces a locale/language choice rather than offering flexibility or documenting a justified regional constraint.
The manifest describes '每日6:30提醒' and an intelligent reminder system, which implies the skill itself performs reminder delivery at that time. In code, the closest implementation only formats reminder messages as strings, while the CLI offers recording, status, reporting, and export functions but no scheduler, timer, or outbound notification mechanism.
The module title and descriptions are entirely in Chinese and present the skill as a general-purpose reminder generator, with no indication that Chinese is optional or that the skill is limited to a Chinese-speaking or region-specific context. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.
The Feishu message explicitly tells users to reply with the Chinese phrase "服药了" alongside one command variant, making Chinese the default interaction language. Because the skill does not offer a user language preference or explain a justified locale limitation, this violates the language/locale policy.
These user-facing instructions tell the recipient how to confirm medication intake entirely in Chinese except for one command token. The file presents no mechanism for selecting another language and no justification that the skill is region- or language-specific, so this is a policy violation.
Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.
"message": message,
"reminder_count": args.count,
"channel": args.channel,
"timestamp": __import__("datetime").datetime.now().isoformat()
}
print(json.dumps(info, ensure_ascii=False), file=sys.stderr)
The manifest’s natural-language fields, including the top-level description, command description, examples, and reminder message, are all Chinese-only. Under the policy rule, forcing a specific language without user opt-in or a documented regional justification is a natural-language policy violation.
The module docstring and all user-facing strings are written exclusively in Chinese, indicating the skill is designed to operate in a fixed language. The file does not provide any user opt-in, locale selection, or justification that this is a region-specific tool, which matches the language/locale policy violation criteria.
The inline help states that reminders repeat every 15 minutes until the user confirms, which describes active reminder delivery behavior. In this file, scheduling is explicitly noted as unimplemented and the code only toggles a setting and generates sample/reminder text, so the documentation overstates what the code does.
The documentation asserts support for two notification channels, implying external delivery integrations. However, the code in this file only returns text response dictionaries and contains no Feishu or WeChat API calls or adapters, so the comment materially misrepresents implemented capabilities.
This Python file contains user-facing descriptions and console instructions in Chinese from the module docstring onward, and all later prompts/messages are likewise fixed to that language. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is clearly documented and justified, which it is not here.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def check_openclaw_installed():
"""检查 OpenClaw 是否已安装"""
try:
result = subprocess.run(
["openclaw", "--version"],
capture_output=True,
text=True,
This Python file contains user-facing natural-language text entirely in Chinese, beginning with the module description. Under the policy rule, forcing a specific language without opt-in is a locale-policy violation unless the file documents that the skill is region-specific or offers a language choice, which it does not.
The cleanup routine operates on the real user data directory under ~/.openclaw/medication_data, backs it up, then overwrites medication-records.json and stats.json with empty/reset contents. In a medication adherence skill, altering historical dosing and adherence data is security-relevant because it can destroy integrity of health records, mislead users about missed or taken doses, and affect downstream reporting.
Natural-language policy violations include forcing a specific language without user opt-in. Here, the description, title, and operating instructions are all presented only in Chinese, with no indication that the user can select another language or that the skill is intentionally limited to a Chinese-speaking audience.
The entire user guide forces a single language/locale presentation without any indication of user choice or a justified region-specific constraint. This matches the policy category for language or locale restrictions that are not opt-in or documented as necessary.