T09 · Insecure Skill Coding Practices
- Location
README.md:10- Finding
Publicly Exposed TJWeather API Credentials
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill does what it says, but users should be aware that weather/location requests and the API key are sent to external services and the documentation includes weak credential-handling examples.
Install only if you are comfortable sending location queries to external geocoding services and coordinates plus your TJWeather API key to TJWeather. Use your own key through SecretRef or an environment variable, avoid plaintext config where possible, and do not rely on the shared trial keys shown in the README.
README.md:10Publicly Exposed TJWeather API Credentials
README.md:37Documentation Encourages Persistent Plaintext API Key Storage
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
try:
req = urllib.request.Request(url)
with urllib.request.urlopen(req, timeout=15) as response:
data = json.loads(response.read().decode('utf-8'))
code = str(data.get('code', '200'))
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""调用 TJWeather API 获取天气数据"""
api_key = os.environ.get('TJWEATHER_API_KEY')
# 兜底:如果环境变量未注入,尝试从同级目录的 .env 文件加载
if not api_key:
env_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '.env')
try:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""调用 TJWeather API 获取天气数据"""
api_key = os.environ.get('TJWEATHER_API_KEY')
# 兜底:如果环境变量未注入,尝试从同级目录的 .env 文件加载
if not api_key:
env_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '.env')
try:
The script reads a plaintext .env file from a relative parent directory to obtain the API key. In shared or multi-tenant environments, this increases the risk of accidental secret exposure, insecure file permissions, or unintentional use of credentials from an unexpected file location.
# 兜底:如果环境变量未注入,尝试从同级目录的 .env 文件加载
if not api_key:
env_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '.env')
try:
with open(env_file, 'r') as f:
for line in f:
The documentation says the skill's primary output language is Chinese, which imposes a language preference by default. Although it mentions dynamic adaptation of data labels, it does not clearly offer the user a language choice or require opt-in for Chinese as the default output language.
The skill invokes local Python scripts, relies on an environment variable API key, and contacts external geocoding/weather services, but it does not declare any explicit tool scope such as permissions or allowed-tools. This creates a governance gap: the runtime may grant broader-than-expected file, env, or network access, making it harder for users and platform controls to constrain what the skill can do.
The skill processes user-supplied location queries and sends them to external weather/geocoding services, but the description does not clearly warn users that their location data will leave the local environment. Because location queries can contain sensitive or identifying information such as home, workplace, or frequently visited places, this omission undermines informed consent and can expose private data to third parties.
This Python file consistently uses Chinese-only natural language in comments, stderr logs, and end-user error/help messages, indicating the skill is effectively constrained to a single language/locale. The file does not offer a language choice or explain a justified region-specific requirement, which matches the language/locale policy-violation category.
This Python skill contains natural-language docstrings, errors, usage text, and formatted output entirely in Chinese, including the main user-visible response strings. Because the file does not offer an opt-in language choice or clearly justify a China-specific locale constraint, it may violate language/locale policy requirements.
The skill transmits user-supplied location data and an API credential to an external third-party service. In this context that is expected functionality, but it still creates a real data exposure boundary: coordinates, query context, and the API key leave the local environment and could be logged by the remote service or by local proxies if mishandled.
lon_val = float(lon)
if lon_val < 0:
lon_val = lon_val + 360
url = f"https://api.tjweather.com/beta?loc={lon_val},{lat}&key={api_key}&fields={fields}&fcst_days={fcst_days}&tz={tz}"
try:
req = urllib.request.Request(url)