T09 · Insecure Skill Coding Practices
- Location
scripts/pet_emotion.py:43- Finding
Cross-Provider API Key Disclosure to DashScope
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This pet-photo analysis skill is purpose-aligned overall, but it has a real credential-handling flaw and unsafe generated-report behavior that users should review before installing.
Review before installing. Use a dedicated DashScope key, avoid running it in an environment with unrelated OPENAI_API_KEY values, and only analyze photos you are comfortable uploading to DashScope. Treat generated HTML reports as untrusted until the template escaping issue is fixed.
scripts/pet_emotion.py:43Cross-Provider API Key Disclosure to DashScope
assets/report_template.html:262Stored HTML and JavaScript Injection in Generated Reports
The skill description and flow do not clearly warn the user that uploaded pet photos are transmitted to DashScope, an external service, for multimodal analysis. This creates a privacy and consent issue because users may believe processing is local while sensitive images are actually sent off-device.
The script reads secrets from environment variables and local config files, but this capability is not reflected in the declared permissions. Hidden secret-access behavior increases the blast radius of a seemingly simple image-analysis skill and can violate least-privilege expectations for users and platforms.
The trigger list contains broad natural-language phrases such as 'pet emotion', '看看我家猫', '看看我家狗', and '帮我看看宠物' that could match ordinary conversation rather than an explicit command. In an agent environment, this can cause unintended invocation of a skill that processes user images and calls an external multimodal API, increasing privacy and consent risk even if the skill's purpose is otherwise harmless.
The trigger list includes broad everyday phrases like '看看我家猫/狗' and '帮我看看宠物', which can activate on casual photo sharing rather than a clear request for analysis. That increases the chance the agent processes and transmits user pet images to the skill without sufficiently explicit user intent.
The activation scenarios say the skill should run when a user shares a pet photo and 'wants to understand mood', which is ambiguous and may over-infer consent from general image sharing. In this skill's context, that is more dangerous because the image is later sent to a third-party API for analysis.
This finding identifies the same outbound request that sends user-provided image data to a third-party API endpoint. While the transmission supports the advertised feature, it is still a true privacy-sensitive behavior and should be treated as such in a skill that may activate on broad triggers.
"temperature": 0.1
}
resp = requests.post(
"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",
headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"},
json=payload, timeout=30
This finding identifies the same outbound request that sends user-provided image data to a third-party API endpoint. While the transmission supports the advertised feature, it is still a true privacy-sensitive behavior and should be treated as such in a skill that may activate on broad triggers.
"temperature": 0.1
}
resp = requests.post(
"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",
headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"},
json=payload, timeout=30
The HTML root sets lang="zh-CN", which hard-codes a specific language/locale for the skill output. Under the policy, forcing a locale without user opt-in or a documented region-specific justification is a natural-language policy violation.
The template loads Chart.js from a third-party CDN at runtime, which introduces a supply-chain and privacy risk: report viewers will make network requests to an external domain, and a compromised or swapped CDN asset could execute arbitrary JavaScript in the report context. This is more concerning because the report also injects multiple template variables directly into the page, so any malicious script would have access to rendered pet analysis data and the surrounding DOM.
Multiple user-visible strings such as AI 情绪识别分析, 置信度, and 情绪分布雷达图 are fixed in Chinese, indicating the skill output is constrained to one language. The file does not show any mechanism for selecting language or notifying users of a locale restriction.
The script uses Chinese-only emotion labels and presents prompts, errors, summaries, and the generated HTML report in Chinese, with no option to select another language. This enforces a specific locale in natural-language outputs without user opt-in.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
}
DASHSCOPE_URL = "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions"
OPENAI_URL = "https://api.openai.com/v1/chat/completions"
def find_api_key():
The skill searches for API keys in multiple locations, including OPENAI_API_KEY and local config files unrelated to the stated pet-emotion purpose. This broad credential harvesting behavior can unintentionally consume unrelated secrets and makes the skill more dangerous if reused, modified, or compromised.
The CLI exposes an 'openai' option, but execution always sends data to DashScope. This mismatch can mislead users about where their image and credentials are going, undermining informed consent and creating an unexpected third-party data transfer.
The script base64-encodes the user's pet photo and transmits it to an external multimodal API without an explicit privacy warning or consent step. Images may contain sensitive metadata or household context, so silent upload to a third party creates a privacy and data-handling risk.
The visible skill title, tagline, and primary usage description are presented in Chinese, and the trigger phrases are predominantly Chinese, with no statement that users may choose another language. This can conflict with a language/locale policy requiring user choice unless the locale restriction is explicitly justified.
The entire markdown file is written in Chinese and provides no indication that language selection is optional or that the skill is intentionally limited to Chinese-speaking users. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy concern.
Detected: suspicious.exposed_secret_literal