T09 · Insecure Skill Coding Practices
- Location
scripts/fetch_star.py:76- Finding
API Key Exposed in URL Query Parameters
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill appears to do what it says: query TianAPI for horoscope data, though users should avoid the less secure API-key examples.
Use a dedicated low-privilege TianAPI key, prefer the TIANAPI_STAR_KEY environment variable, avoid passing the key on the command line, do not commit scripts/.env, and assume horoscope requests are sent to TianAPI over the network.
scripts/fetch_star.py:76API Key Exposed in URL Query Parameters
scripts/fetch_star.py:108API Key Accepted and Documented as a Command-Line Argument
The skill instructs users to write the API key into scripts/.env inside the project tree. Storing secrets in a repository-adjacent file increases the chance of accidental inclusion in version control, backups, archives, or unintended file reads by other tooling.
export TIANAPI_STAR_KEY=你的APIKey
# 方式二:.env 文件(在脚本目录创建)
echo "TIANAPI_STAR_KEY=你的APIKey" > scripts/.env
# 方式三:每次命令行传入
python3 scripts/fetch_star.py 你的APIKey 狮子座
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Env Config:
export TIANAPI_STAR_KEY=your_api_key
# 或在脚本同级目录创建 .env 文件: TIANAPI_STAR_KEY=your_api_key
"""
import os
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Env Config:
export TIANAPI_STAR_KEY=your_api_key
# 或在脚本同级目录创建 .env 文件: TIANAPI_STAR_KEY=your_api_key
"""
import os
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Env Config:
export TIANAPI_STAR_KEY=your_api_key
# 或在脚本同级目录创建 .env 文件: TIANAPI_STAR_KEY=your_api_key
"""
import os
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Env Config:
export TIANAPI_STAR_KEY=your_api_key
# 或在脚本同级目录创建 .env 文件: TIANAPI_STAR_KEY=your_api_key
"""
import os
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
Env Config:
export TIANAPI_STAR_KEY=your_api_key
# 或在脚本同级目录创建 .env 文件: TIANAPI_STAR_KEY=your_api_key
"""
import os
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
return env_val
# 2. .env 文件
env_file = Path(__file__).parent / ".env"
if env_file.exists():
try:
content = env_file.read_text(encoding="utf-8")
The skill documents use of environment variables, local files, and outbound network access, but it does not declare any explicit tool scope or permissions boundary. That increases the risk of over-broad execution in hosts that rely on manifest-declared permissions, making review, sandboxing, and least-privilege enforcement harder.
The skill shows the API key being supplied directly as a command-line argument and embedded in a raw GET URL. Secrets passed this way can be exposed through shell history, process listings, logs, browser history, proxies, and server access logs, leading to credential leakage and unauthorized API use.
The script transmits both user-supplied input and the API key to a third-party network service, but it does not clearly warn the user that their query and credential will leave the local environment. In an agent skill context, this matters because users may assume a local utility while the skill silently performs external data exfiltration of prompts/parameters and secrets to the remote API provider.
The usage guidance tells the operator to send user-provided astrology and date inputs to an external TianAPI service without clearly disclosing that this is third-party network transmission. This is a privacy and transparency issue, especially in environments where users may expect local-only processing.