T09 · Insecure Skill Coding Practices
- Location
scripts/refine.py:251- Finding
API Credential and Private Subtitle Content Are Written to Process Logs
- Content
View full analysis
Vulnerability Details
File Location:
scripts/refine.py, lines 251-270
Vulnerability Type: Sensitive information exposure through verbose logging
Risk Level: HighVulnerable Code
python print(f"🔑 认证: Bearer {SILICONFLOW_API_KEY}", file=sys.stderr) print(f"⏱️ 超时: 连接=10秒, 读取=300秒", file=sys.stderr) # 打印消息内容(完整不截断) print(f"\n💬 消息数量: {len(messages)}", file=sys.stderr) for i, msg in enumerate(messages, 1): role = msg.get("role", "unknown") content = msg.get("content", "") print(f"\n{'=' * 80}", file=sys.stderr) print(f" 消息 {i} [{role}]:", file=sys.stderr) print(f"{'=' * 80}", file=sys.stderr) print(f"{content}", file=sys.stderr) print(f"{'=' * 80}", file=sys.stderr) # 打印完整的 payload(格式化的 JSON,完整内容) print(f"\n📦 完整请求体(JSON):", file=sys.stderr) print(f"{'=' * 80}", file=sys.stderr) print("```json", file=sys.stderr) print(json.dumps(payload, indent=2, ensure_ascii=False), file=sys.stderr) print("```", file=sys.stderr) print(f"{'=' * 80}\n", file=sys.stderr)Technical Analysis
The API request function writes the complete
SILICONFLOW_API_KEYbearer credential to standard error. It also logs every complete prompt and the complete request payload without truncation or redaction.The prompts contain user-supplied subtitle content. Topic detection transmits and logs the first 20 subtitle entries, while subsequent refinement requests collectively process and log the rest of the subtitle document. Consequently, both an authentication secret and potentially confidential media transcripts can enter terminal history, OpenClaw logs, process-supervisor logs, CI output, centralized telemetry, or other diagnostic storage.
Logging the credential is not required to perform API authentication, token accounting, subtitle refinement, or error diagnosis. It exceeds the minimum information necessary for the declared functionality.
Attack Path
- A user c ...[truncated 1298 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove all logging of the
Authorizationheader andSILICONFLOW_API_KEY. - If authentication status must be logged, use a constant redacted value such as
Bearer [REDACTED]. - Do not log complete prompts, message arrays, payloads, API responses, or subtitle text by default.
- Restrict normal diagnostics to non-sensitive metadata such as the endpoint hostname, model name, request identifier, content length, status code, and token counts.
- If content-level debugging is required, place it behind an explicit opt-in debug setting, display a privacy warning, redact sensitive fields, and limit retained text.
- Configure logs with restrictive permissions, short retention periods, and controls preventing transmission to untrusted telemetry systems.
- Rotate any API key that may already have appeared in logs and delete affected logs where operationally possible.
- Add automated tests that capture standard output and standard error and verify that neither the API key nor representative subtitle text appears.
- Remove all logging of the
