T09 · Insecure Skill Coding Practices
- Location
scripts/memory_tree.py:221- Finding
Overbroad Access to Credential-Bearing OpenClaw Configuration
- Content
View full analysis
Vulnerability Details
File Location:
scripts/memory_tree.py:30,scripts/memory_tree.py:221-233,scripts/memory_tree.py:359-371
Vulnerability Type: Excessive configuration access and unsafe recipient inference
Risk Level: LowComplete Code Snippet
python OPENCLAW_CONFIG = Path.home() / ".openclaw" / "openclaw.json"python def detect_enabled_channels(): """从 openclaw.json 检测已启用的推送渠道""" config = load_json(OPENCLAW_CONFIG) channels = config.get('channels', {}) enabled = [] for name, cfg in channels.items(): if cfg.get('enabled', False): enabled.append({ 'name': name, 'config': cfg, }) return enabledpython channels = detect_enabled_channels() if channels: print(f"📡 检测到已启用渠道: {', '.join(c['name'] for c in channels)}") for ch in channels: if ch['name'] == 'feishu': chat_id = get_feishu_chat_id(ch['config']) if chat_id: print(f"\n📱 飞书推送配置:") print(f" chat_id: {chat_id}") print(f"\n💡 推送命令:") print(f" message send --target {chat_id} --file {report_file}")Technical Analysis
The
weeklyoperation reads the complete~/.openclaw/openclaw.jsonfile and retains the complete configuration object for every enabled channel. Local weekly-report generation does not require access to channel credentials or unrelated channel settings.Although the current implementation does not print credentials or transmit the report, retaining complete channel configuration objects unnecessarily expands the sensitive-data exposure surface. A future logging statement, exception handler, plugin, or modification could inadvertently disclose secrets stored in those objects.
The code also chooses the first entry in Feishu's
groupAllowFromlist as the suggested destination. That list is an access-control list, not necessarily an ...[truncated 1427 chars]- Remediation
View remediation
Remediation Suggestions
- Keep weekly-report generation local by default and do not read
openclaw.jsonunless the user explicitly requests sharing. - Require an explicit
--shareand--targetargument before preparing or performing external delivery. - Extract only the minimum required values instead of retaining each complete channel configuration object.
- Never place authentication tokens, secrets, or complete configuration mappings into returned data structures.
- Do not infer a report recipient from
groupAllowFrom; treat authorization lists and delivery destinations as separate concepts. - Display the selected recipient and require explicit confirmation before any future transmission feature.
- Add tests confirming that local report generation does not access channel credentials or perform network operations.
- Keep weekly-report generation local by default and do not read
