T09 · Insecure Skill Coding Practices
- Location
scripts/fetch_geopolitics.py:46- Finding
Unauthenticated HTTP Sources Allow Manipulation of Risk-Scoring Inputs
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a coherent Chinese A-share premarket risk-reporting skill with disclosed public-data fetching and optional Feishu posting, but it has integrity hardening gaps users should understand.
Install only if you are comfortable with a Chinese A-share focused tool that fetches public market/news data and may send generated summaries to Feishu when you explicitly configure and run the push workflow. Prefer disabling or removing the included GitHub Actions workflow unless you want scheduled posts, keep Feishu secrets scoped to that webhook, and harden the code by requiring HTTPS sources, escaping HTML output, and constraining NOTIFY_HUB_SCRIPT before using it for routine financial decisions.
scripts/fetch_geopolitics.py:46Unauthenticated HTTP Sources Allow Manipulation of Risk-Scoring Inputs
scripts/render_card.py:55Remote News Titles Are Inserted into Generated HTML Without Escaping
The skill advertises and documents executable capabilities including shell commands, network access, file generation, and use of environment-backed secrets, but it does not declare any explicit tool scope or permission boundaries. In an agent ecosystem, this can lead to over-privileged execution, making unintended network calls, writing files, or accessing sensitive environment variables without clear user consent or platform enforcement.
The trigger phrases are broad finance terms such as '外围市场' and '风险信号' that can appear in ordinary conversation, increasing the chance the skill is invoked when the user did not intend it. Unintended invocation is risky here because the skill may perform network retrieval, generate reports, or prepare outbound notifications based on casual discussion rather than an explicit request.
The skill promotes Feishu group push support, including webhook-based cloud delivery, but the description does not prominently warn that generated content may be transmitted to an external group/channel. This creates a data-handling and consent risk: users may trigger or enable sharing without fully understanding that reports, market interpretations, or metadata could leave the local environment.
The code explicitly prefers plain HTTP for GDELT requests and only falls back to HTTPS on failure, which exposes requests and responses to tampering or interception by any network attacker on the path. Because the fetched geopolitical news is later used to generate trading/risk signals, a man-in-the-middle could manipulate article metadata and bias downstream risk scoring or user decisions.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
# 2. 全球底色(World Bank API,年度,无 key)
# 指标:GDP 增速 / CPI 年化 / 失业率,覆盖美国、中国、全球
# ---------------------------------------------------------------------------
WB = "https://api.worldbank.org/v2/country/{}/indicator/{}?format=json&per_page=3"
# (指标代码, 指标名, 单位后缀)
WB_INDICATORS = [
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
# 3. 美国高频宏观(FRED,可选 key)
# 读环境变量 FRED_API_KEY;无 key 时跳过,返回空 dict(由 World Bank 兜底)
# ---------------------------------------------------------------------------
FRED = "https://api.stlouisfed.org/fred/series/observations"
# (series_id, 说明)
FRED_SERIES = [
This code file contains user-facing natural language exclusively in Chinese in the module docstring, including usage instructions. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicit and justified.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
print("请先安装 notify-hub skill,或设置 NOTIFY_HUB_SCRIPT 环境变量。")
sys.exit(1)
print(f"推送到: {target}")
r = subprocess.run(
[sys.executable, NOTIFY, "send", "card", json_path, "--to", target],
capture_output=True, text=True,
)
The script path executed by Python comes from the NOTIFY_HUB_SCRIPT environment variable, which means anyone who can influence the environment can redirect execution to an arbitrary local Python file. In agent or automation contexts where environment variables may be inherited from untrusted configuration, this becomes arbitrary code execution in the context of the user running the skill.
print("请先安装 notify-hub skill,或设置 NOTIFY_HUB_SCRIPT 环境变量。")
sys.exit(1)
print(f"推送到: {target}")
r = subprocess.run(
[sys.executable, NOTIFY, "send", "card", json_path, "--to", target],
capture_output=True, text=True,
)
The payload explicitly sends content under the "zh_cn" locale, and the script's user-facing strings are all Chinese. This forces a specific language/locale without any opt-in or documented justification that the skill is only for a Chinese-language context, which matches the policy's language/locale violation criterion.
The design note states '只取「标题 + 国家 + 时间 + 重要性」, 不抓全文', which communicates a deliberately narrow data scope. However, the event objects built later also include 'actual', 'forecast', and 'previous', so the documentation understates what fields are collected and returned.
The natural-language docstring is entirely written in Chinese and presents the skill usage and behavior only in that language. Under the policy, forcing a specific language without user choice can be a locale/language policy violation unless clearly justified or optionality is provided.
This code file contains natural-language docstring content entirely in Chinese for the module description and usage context. Under the stated policy, forcing a specific language without user opt-in can be a locale/language policy violation, and there is no indication of an alternative language option or justification for a Chinese-only audience.
The JSON output includes user-facing fields such as source and note only in Chinese. This reinforces a fixed-language experience without documenting a justified locale constraint or offering an alternative language.
This code file contains natural-language guidance that mandates a locale-specific convention: '所有方向判断遵循 A 股习惯:红 = 利多、绿 = 利空'. The policy allows locale constraints only when clearly documented and justified; while this is somewhat contextual, it still hard-codes a market-specific convention without exposing any user choice or opt-in.
The HTML root sets lang="zh-CN", and the entire visible UI text is fixed in Simplified Chinese. This creates a language/locale constraint in natural-language content without any indication that users can choose another language or have opted into a China-specific experience.