T09 · Insecure Skill Coding Practices
- Location
scripts/book_isbn_query.py:22- Finding
Environment-Controlled API Endpoint Can Disclose the AppKey
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a coherent ISBN lookup tool, but it has an undocumented API endpoint override that could send the user's API key to an unintended server.
Review this before installing if you will use a real Jike AppKey. The skill's normal behavior is to send the ISBN and AppKey to Jike's API, but the script also honors an undocumented JIKE_API_BASE_URL variable; only run it in an environment where that variable cannot be set by untrusted code, and avoid passing the key with --key because command-line arguments may be exposed locally.
scripts/book_isbn_query.py:22Environment-Controlled API Endpoint Can Disclose the AppKey
The request URL is built from API_BASE_URL, which is sourced from the environment and then passed directly to urllib.request.urlopen. If an attacker can influence environment variables in the agent runtime, they can redirect requests and the included appkey to an arbitrary host, causing credential exfiltration or unintended outbound access. In this skill context, the danger is somewhat reduced because this is a simple ISBN lookup client, but it still transmits a secret in the query string to a user-controlled endpoint when JIKE_API_BASE_URL is overridden.
params = {"isbn": isbn, "appkey": appkey}
url = f"{API_BASE_URL}{API_PATH}?{urllib.parse.urlencode(params)}"
try:
with urllib.request.urlopen(url, timeout=15) as response:
return json.loads(response.read().decode("utf-8"))
except urllib.error.HTTPError as exc:
return {"code": exc.code, "message": f"接口请求失败: HTTP {exc.code}", "data": ""}
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
env_value = os.environ.get(env_name, "").strip()
if env_value:
return env_value
env_file = Path(__file__).parent / ".env"
if not env_file.exists():
return ""
for line in env_file.read_text(encoding="utf-8").splitlines():
The skill declares executable behavior that uses environment variables, file access, and network access, but it does not explicitly declare any tool scope or permissions. This creates an authorization and transparency gap: a host agent may permit broader capabilities than intended, and reviewers or users cannot clearly see what resources the skill is expected to access.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
"title": "ISBN图书查询 - 即刻数据",
"description": "输入 ISBN-10 或 ISBN-13,查询书名、作者、译者、出版社、出版日期、页数、定价、装帧、丛书和封面等信息。",
"env": "JIKE_BOOK_ISBN_QUERY_KEY",
"api_url": "https://api.jikeapi.cn/v1/book/isbn/query",
"homepage": "https://www.jikeapi.cn/"
}
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
"title": "ISBN图书查询 - 即刻数据",
"description": "输入 ISBN-10 或 ISBN-13,查询书名、作者、译者、出版社、出版日期、页数、定价、装帧、丛书和封面等信息。",
"env": "JIKE_BOOK_ISBN_QUERY_KEY",
"api_url": "https://api.jikeapi.cn/v1/book/isbn/query",
"homepage": "https://www.jikeapi.cn/"
}
This code file contains natural-language documentation and CLI messages entirely in Chinese, and the script does not offer any locale or language selection. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation.
No suspicious patterns detected.