T09 · Insecure Skill Coding Practices
- Location
scripts/videogen.py:75- Finding
API Key Disclosure Through an Unrestricted Custom Base URL
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is mostly a coherent AI-HIVE video helper, but it needs review because it handles API keys and downloads files with under-scoped network and filename safeguards.
Review before installing. Use this only with the default AI-HIVE endpoint or a trusted endpoint, keep API keys scoped and revocable, avoid setting AI_HIVE_BASE_URL from untrusted instructions, confirm any billable generation before running commands, and choose an output directory where accidental overwrites would not damage important files.
scripts/videogen.py:75API Key Disclosure Through an Unrestricted Custom Base URL
scripts/videogen.py:399Arbitrary File Write Through Server-Controlled Download Filenames
The declared description presents a comprehensive Happy Horse video toolbox with decision logic and external API-driven media workflow capabilities. The actual code chunk is a simple command-line utility that creates a JSON brief from user-supplied fields. It does not access external services, process media, generate prompts dynamically, choose modes, or perform any of the described API operations. While blueprint creation is loosely related to pre-production planning, the primary behavior is materially narrower and different from the declared end-to-end video tool functionality, so this is a clear description-behavior mismatch.
The declared description centers on an AI-powered Happy Horse video production toolbox with model/mode recommendation and external API-driven generation workflows. The supplied code does none of that. It is a small local utility wrapping ffmpeg/ffprobe to perform basic deterministic edits and inspection. While video editing is loosely mentioned in the description, the primary purpose and capabilities are materially different: the declaration emphasizes AI generation, reference handling, pricing/routing, and asynchronous API orchestration, whereas the code only performs straightforward local media transformations. This is a clear description-behavior mismatch.
The skill advertises and demonstrates capabilities that involve environment variables, local file access, network calls, and shell execution, but it does not declare any explicit tool scope or allowed-tools boundary. That weakens least-privilege controls and can let a broadly triggered skill access sensitive resources or perform side effects beyond what users expect.
The trigger phrases include very broad terms such as general AI video and video editing requests, which can cause the skill to activate in many unrelated contexts. In combination with undeclared network, file, env, or shell-capable behavior, overbroad activation increases the chance of unintended execution, exposure of local resources, or user confusion about what tool is acting.
The default prompt hard-codes Chinese output ('production-ready Chinese workflow') without explicit user opt-in. This can override user preference, reduce transparency for users expecting another language, and make generated workflows or commands harder for some users or reviewers to validate, which slightly increases the risk of misunderstandings in security- or compliance-sensitive operations.
The skill enables implicit invocation without any visible trigger constraints, exclusions, or narrowing conditions. Because this skill can generate production-ready workflows and runnable AI-HIVE commands for video creation/editing, broad auto-invocation increases the chance it is invoked in contexts the user did not clearly intend, which can cause unauthorized tool use, unintended content generation, or policy-bypassing assistance.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def run(args: list[str]) -> None:
print(" ".join(args))
subprocess.run(args, check=True)
def main() -> None:
The top-level docstring describes a '通用 AI 能力调用工具' that supports text chat, image generation, video generation, model queries, media upload, and task polling. The skill manifest, however, frames this skill specifically as a Happy Horse video toolkit for selecting T2V/I2V/R2V video workflows, so the file's documented purpose is materially broader than the declared skill scope.
The module docstring presents the tool entirely in Chinese as a general-purpose skill description, and the rest of the user-facing prompts/help text are likewise Chinese-only. For a general-purpose skill, this constitutes a locale/language constraint without any explicit user opt-in or documented justification.
The code implements a full text chat API client and exposes it through command handling elsewhere in the file, even though the manifested skill is specifically about generating, referencing, and editing Happy Horse videos. General chat is not an obvious requirement for selecting video modes, uploading reference assets, polling jobs, or downloading video outputs.
This file contains an image generation endpoint wrapper and associated command path, which expands the skill into standalone image generation rather than Happy Horse video creation/editing. The manifest emphasizes T2V/I2V/R2V video workflows and related delivery checks, not generic image generation as a primary capability.
This code embeds user-facing natural-language strings primarily in Chinese, including the tool name, defaults, and content fields, without any indication that users can opt into another language. Under the policy, forcing a specific language or locale without user opt-in is a natural-language policy concern.
The skill-specific parser describes the program as a video skill, but the file itself also contains broader generic AI operations and a separate parser exposing text chat, image generation, model listing, and user-info actions. This creates an intent/documentation split inside the file: the comments and descriptions suggest a narrower video-focused tool than the codebase actually implements.