T09 · Insecure Skill Coding Practices
- Location
scripts/generate_image.py:83- Finding
Unrestricted Retrieval of API-Controlled URLs in Image Generation
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill appears to be a real image-generation API helper, but users should review it because its billing/output behavior and remote-download handling are not fully aligned with the documentation.
Install only if you are comfortable sending prompts, image URLs, and your API token to api.laozhang.ai. Use a restricted token file with tight permissions instead of --token on the command line, avoid sensitive/private images, use --no-save when you do not want local files written, and explicitly choose the model so billing matches your expectation.
scripts/generate_image.py:83Unrestricted Retrieval of API-Controlled URLs in Image Generation
scripts/edit_image.py:85Unrestricted Retrieval of API-Controlled URLs in Image Editing
scripts/generate_image.py:127API Token Exposure Through Command-Line Arguments
SKILL.md:12Plaintext Token File Permissions Are Not Enforced
scripts/generate_image.py:25Implemented Default Model Conflicts With Documented Pricing and Output Behavior
This mismatch becomes security-relevant because the description omits material side effects: reading a local token file and saving/downloading images locally. When a skill understates resource access, users may expose local secrets or permit filesystem changes without informed consent.
This mismatch becomes security-relevant because the description omits material side effects: reading a local token file and saving/downloading images locally. When a skill understates resource access, users may expose local secrets or permit filesystem changes without informed consent.
The skill documentation instructs users to read a local token file, write image outputs to disk, and call an external API, but it does not declare any explicit tool scope or permissions. This creates a transparency and containment problem: an agent or user may invoke a skill with file and network side effects that were not clearly bounded in metadata.
Broad trigger phrases increase the chance the skill is invoked unintentionally during ordinary conversation about images or drawing. In this skill's context, accidental activation can cause external API requests, spend money, and transmit prompts or image URLs off-platform.
The skill does not clearly warn that prompts and image URLs/content will be sent to a third-party API and that results may be saved locally. This lack of data-handling disclosure can lead users to unknowingly transmit sensitive images, internal URLs, or confidential prompts to an external service.
The skill transmits data to an external service, which is expected for an API-backed image tool, but it still introduces privacy, data-exposure, and billing risk. In this context the danger is elevated because prompts, image URLs, and possibly image content may leave the local environment, yet disclosure and consent language are weak.
echo "sk-xxx" > ~/.laozhang_api_token
访问 [老张 API](https://api.laozhang.ai/register/?aff_code=lfa0) 注册获取 token。新注册自动获得 $0.5 测试额度。
### 2. 文生图
The example explicitly shows supplying an API token on the command line (--token sk-xxx). Command-line arguments are commonly exposed through shell history, process listings, logging, CI job output, and telemetry, so this can leak credentials to other local users or systems that collect command invocations.
The script reads a bearer token from ~/.laozhang_api_token and later uses it for authenticated API access, but this credential access is not explained in the function via comments/docstrings. For code-file warnings, sensitive credential access should have some visible disclosure unless already clearly documented in the skill description, which is not present in this file beyond an error message when the token is missing.
The script transmits user-supplied image URLs and edit prompts to a third-party API, which may expose sensitive image contents or metadata to an external service without clear user-facing notice. In an agent-skill context, this matters because users may assume local-only processing unless explicitly told otherwise.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
}
try:
resp = requests.post(API_URL, headers=headers, json=payload, timeout=120)
resp.raise_for_status()
result = resp.json()
This code file contains natural-language strings that present the skill exclusively in Chinese, including the top-level description and usage text. Under the policy, forcing a specific language without offering a user language choice is a natural-language policy violation.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
print("需要安装 requests 库:pip install requests")
sys.exit(1)
API_URL = "https://api.laozhang.ai/v1/chat/completions"
MODELS = {
"sora_image": ("Sora Image", "$0.01/张", "url"),
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
print("需要安装 requests 库:pip install requests")
sys.exit(1)
API_URL = "https://api.laozhang.ai/v1/chat/completions"
MODELS = {
"sora_image": ("Sora Image", "$0.01/张", "url"),
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
print("需要安装 requests 库:pip install requests")
sys.exit(1)
API_URL = "https://api.laozhang.ai/v1/chat/completions"
MODELS = {
"sora_image": ("Sora Image", "$0.01/张", "url"),
The script transmits user prompts and an API bearer token to a third-party service, which is an actual external data exposure point. In this skill context that behavior is expected for image generation, but it is still security-relevant because sensitive prompts may be sent off-host and the script also follows returned image URLs for download, expanding trust to remote content.
}
try:
resp = requests.post(API_URL, headers=headers, json=payload, timeout=120)
resp.raise_for_status()
result = resp.json()
整个技能说明及触发词均仅以中文呈现,没有说明这是面向特定中文场景的限定,也未提供用户语言选择。根据语言/地区策略,若技能隐含强制特定语言而无用户选择或合理依据,属于自然语言策略风险。
The natural-language content, examples, and comments are all presented in Chinese, which may impose a language constraint on users without explicitly offering alternatives. The file does not mention that the skill is Chinese-only or provide any opt-in or language selection.
This markdown file contains all user-facing instructions and descriptions in Chinese only. Under the language/locale policy, forcing a single language without user opt-in or a documented regional justification is a natural-language policy concern.
The manifest focuses on using the API to generate and edit images, but does not disclose that results are automatically persisted under ~/Pictures/laozhang. Saving files is a separate local-write capability that users may not expect from the high-level description alone.
The manifest describes generating and editing images via the 老张 API, but does not mention local credential-file access. The code reads a token from ~/.laozhang_api_token, which is a local data-access capability beyond the user-facing image-editing function, even though it is a convenience mechanism rather than the core feature.