T09 · Insecure Skill Coding Practices
- Location
scripts/cn_quote.py:106- Finding
Stock quote data is retrieved over unauthenticated plaintext HTTP
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill mostly matches its stock quote/news purpose, but it documents an optional privileged gateway-wide proxy change and uses a plaintext quote source that can let network intermediaries observe or alter market data.
Install only if you are comfortable with outbound market-data requests and optional Finnhub API-key use. Avoid the systemd-wide proxy setup unless an administrator intentionally wants all gateway traffic routed through that proxy, and treat CN/HK quotes from the Tencent plaintext source as unverified market data.
scripts/cn_quote.py:106Stock quote data is retrieved over unauthenticated plaintext HTTP
SKILL.md:128Documentation recommends a privileged, service-wide persistent proxy configuration
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
req = request.Request(url, headers={"User-Agent": "OpenClaw/1.0"})
for attempt in range(1 + NEWS_RETRIES):
try:
with request.urlopen(req, timeout=15) as r:
data = json.loads(r.read().decode())
return data if isinstance(data, list) else None
except (error.HTTPError, error.URLError, json.JSONDecodeError, OSError) as e:
The declared description covers both stock quotes and news, plus specific source usage across markets. The supplied code is narrowly a news-fetching script: it detects CN/HK vs US symbols, fetches CN/HK news through a separate cn_news module (described in comments as EastMoney→AkShare) and US news via Finnhub's company-news endpoint. That means the actual behavior shown matches only the 'news' subset of the description, not the broader 'stock quotes and news' capability. It also does not show Yahoo or Tencent usage, which are part of the declared source description. Because the primary purpose in this chunk is materially narrower than the declared purpose, this is a description/behavior mismatch.
The code clearly matches the stock quote portion of the description: it fetches quote data for symbols, including US and potentially CN/HK symbols, using Yahoo and Finnhub, with a local fallback module for CN/HK. However, there is no implementation of any news retrieval capability in this chunk, despite the declared description stating 'stock quotes and news.' Additionally, for CN/HK the declared sources are Tencent/EastMoney/AkShare, but this file itself does not access those services directly; it only attempts to load cn_quote.py for CN/HK handling. That source discrepancy is weaker because the delegated module may implement those providers, but based on this chunk alone, the direct behavior is quote-only. Therefore this is a description/behavior mismatch, primarily due to the missing news functionality.
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
在 gateway 可读到的环境里设置即可,例如 `~/.openclaw/.env` 中加入 `HTTPS_PROXY=...` 和 `HTTP_PROXY=...`。或当前 shell 测试:`export HTTPS_PROXY=http://127.0.0.1:7890` 后执行 `python3 scripts/quote.py AAPL`。
**可选:systemd 全局**(仅当你用 systemd 跑 gateway 且希望所有请求走代理时)
编辑 `/etc/systemd/system/openclaw-gateway.service` 在 `[Service]` 下增加 `Environment=HTTPS_PROXY=...` / `HTTP_PROXY=...`,然后 `sudo systemctl daemon-reload && sudo systemctl restart openclaw-gateway`。注意这会对该服务下所有请求生效。
**可选环境变量**(仅 `quote.py`):`OPENCLAW_QUOTE_TIMEOUT`(默认 12 秒)、`OPENCLAW_QUOTE_RETRY_DELAY`(单 symbol 顺序时的间隔,默认 0.4 秒)、`OPENCLAW_QUOTE_CACHE_TTL`(结果缓存秒数,0=关闭)。多 symbol 时默认**并行**请求以提升性能,可通过 `OPENCLAW_QUOTE_PARALLEL=0` 关闭;`OPENCLAW_QUOTE_MAX_WORKERS`(默认 6)控制并行度。**失败重试**:`quote.py` 单次 HTTP 请求默认最多重试 2 次(共 3 次),5xx/超时/断线会指数退避;可通过 `OPENCLAW_QUOTE_RETRIES=0` 关闭。`cn_quote.py` 与 `news.py` 同样对单次请求做最多 2 次重试。
The skill explicitly documents use of environment variables and outbound network access, but it does not declare any tool scope such as permissions or allowed-tools. That creates a capability transparency gap: an agent or reviewer cannot easily constrain or audit what the skill is permitted to access, increasing the risk of unintended network use or leakage through inherited environment configuration.
The skill includes substantial Chinese-language trigger examples and operational guidance such as Chinese-only stock-query phrases, but does not state that the skill is intended specifically for Chinese-speaking users or offer alternative language handling. This can violate language/locale policy because it effectively imposes a language expectation without user opt-in or justification.
The documentation instructs users to modify a systemd service and run sudo commands to apply proxy settings globally. Even though this is presented as optional setup guidance, encouraging privileged changes for a market-data skill expands blast radius: misconfiguration could route all gateway traffic through an attacker-controlled proxy or expose secrets and requests from unrelated skills.
在 gateway 可读到的环境里设置即可,例如 `~/.openclaw/.env` 中加入 `HTTPS_PROXY=...` 和 `HTTP_PROXY=...`。或当前 shell 测试:`export HTTPS_PROXY=http://127.0.0.1:7890` 后执行 `python3 scripts/quote.py AAPL`。
**可选:systemd 全局**(仅当你用 systemd 跑 gateway 且希望所有请求走代理时)
编辑 `/etc/systemd/system/openclaw-gateway.service` 在 `[Service]` 下增加 `Environment=HTTPS_PROXY=...` / `HTTP_PROXY=...`,然后 `sudo systemctl daemon-reload && sudo systemctl restart openclaw-gateway`。注意这会对该服务下所有请求生效。
**可选环境变量**(仅 `quote.py`):`OPENCLAW_QUOTE_TIMEOUT`(默认 12 秒)、`OPENCLAW_QUOTE_RETRY_DELAY`(单 symbol 顺序时的间隔,默认 0.4 秒)、`OPENCLAW_QUOTE_CACHE_TTL`(结果缓存秒数,0=关闭)。多 symbol 时默认**并行**请求以提升性能,可通过 `OPENCLAW_QUOTE_PARALLEL=0` 关闭;`OPENCLAW_QUOTE_MAX_WORKERS`(默认 6)控制并行度。**失败重试**:`quote.py` 单次 HTTP 请求默认最多重试 2 次(共 3 次),5xx/超时/断线会指数退避;可通过 `OPENCLAW_QUOTE_RETRIES=0` 关闭。`cn_quote.py` 与 `news.py` 同样对单次请求做最多 2 次重试。
The script emits user-facing status text in Chinese, including the quote label and failure message, with no option to select another language. This is a natural-language locale policy issue because the skill imposes a specific language on all users without opt-in or justification in the file.
The docstring, argparse description, help text, and several user-facing messages are written in Chinese, including mixed Chinese output for both CN/HK and US stock paths. This imposes a specific language on users without offering opt-in, selection, or documenting that the skill is intentionally region-specific.
The user-facing output includes hardcoded Chinese labels like "涨跌", "成交量", and "52周" while other messages and CLI help are in English. This forces a locale/language choice on users without opt-in or configuration, which matches the policy-violation category for language or locale constraints.
This code presents its user-facing description, argument help, and error/output messages only in Chinese. Under the language/locale policy, forcing a specific language without user opt-in can be a natural-language policy violation unless a locale restriction is explicitly documented and justified.
No suspicious patterns detected.