T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:156
- Finding
- Unnecessary Plaintext API Key Stored in Persistent Scheduler Configuration<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 156–179 **Vulnerability Type**: Plaintext credential exposure in persistent configuration **Risk Level**: Medium ### Vulnerable Code ```bash # 编辑 crontab crontab -e # 添加(每小时整点执行) 0 * * * * cd ~/finance && FINNHUB_API_KEY=你的key /usr/bin/python3 fetch_data.py --db-path ~/finance/finance.db >> ~/finance/fetch.log 2>&1 ``` ```text ### Windows 任务计划程序 1. 创建基本任务,触发器:每小时 2. 操作:启动程序 → `py` 3. 参数:`fetch_data.py --db-path C:\Users\你\finance\finance.db` 4. 在用户环境变量中设置 `FINNHUB_API_KEY=你的key` ``` ```json { "cron": "0 * * * *", "command": "python3", "args": ["fetch_data.py", "--db-path", "~/finance/finance.db"], "env": { "FINNHUB_API_KEY": "你的key" }, "workdir": "~/finance" } ``` ### Technical Analysis The documentation instructs users to place a Finnhub API key directly into crontab, an OpenClaw cron environment object, or a persistent user environment variable. These locations may be exposed through scheduler inspection tools, configuration exports, backups, diagnostics, or compromise of the same user account. This credential is not necessary for the implemented functionality. `scripts/fetch_data.py` only performs unauthenticated HTTPS requests to fixed CNBC quote URLs. Its argument parser does not support `--finnhub-key`, and the script does not read `FINNHUB_API_KEY`. Persisting the key therefore exceeds the minimum privileges and information required by the Skill. The scheduled execution itself is visible, explicitly configured by the user, and aligned with periodic financial monitoring. It is not evidence of a covert backdoor. The vulnerability is the unnecessary persistence and exposure of a real credential within scheduler configuration. ### Attack Path 1. A user follows `SKILL.md` and substitutes a real Finnhub API key for the placeholder. 2. The key is saved in crontab, OpenClaw scheduler configuration, or the user's persistent environment. 3. A local process, diagnostic u ...[truncated 1043 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove all Finnhub credential instructions from `SKILL.md` because the current implementation only retrieves public CNBC pages and does not use Finnhub. 2. Remove the documented `--finnhub-key` option because `scripts/fetch_data.py` does not implement it. 3. Remove `FINNHUB_API_KEY` from all crontab, OpenClaw cron, Windows Task Scheduler, and usage examples. 4. If Finnhub support is added later, retrieve the key at runtime from an operating-system credential manager or another dedicated secret-management facility. 5. If a secret file is unavoidable, store it outside the repository, restrict its permissions to the owning account, and reference the file rather than embedding the key in scheduler configuration. 6. Ensure logs and error messages never include credential values. 7. Document how users can inspect and remove installed scheduled tasks. 8. Require explicit user approval before creating any recurring task, and provide a non-persistent manual execution option as the default. 9. Revoke and rotate any real Finnhub key that was previously placed in scheduler configuration. ]]>
