T09 · Insecure Skill Coding Practices
- Location
scripts/clean_video.sh:101- Finding
Arbitrary Recursive Deletion Through a User-Controlled Work Directory
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is mostly purpose-aligned video cleanup tooling, but its cleanup and extension mechanisms create real data-loss and command-execution risks that should be reviewed before installation.
Review this before installing or running on important data. Use Gemini mode only when you intend to send video frames and masks to Google, use only trusted editor commands, and do not pass an existing or valuable directory as --workdir unless the cleanup behavior has been fixed or contained.
scripts/clean_video.sh:101Arbitrary Recursive Deletion Through a User-Controlled Work Directory
scripts/clean_video.sh:59Predictable Work Directory Permits Symlink-Based File Overwrite and Environment-File Tampering
SKILL.md:6Third-Party Python Dependencies Are Not Version-Pinned
The declared description centers on cleaning videos by removing overlays and orchestrating media-editing workflows. However, the supplied code does not process video, frames, masks, overlays, or FFmpeg at all. Its primary purpose is to prepare execution advice from prior run data: it loads persistent learnings, derives recommended retries/concurrency/prompt hints, and emits advisory files. That is a materially different function from the declared media-cleanup behavior, so this is a clear mismatch.
The script reads an API key from the environment and uses it to call an external model service, but the static finding indicates this environment access is not declared in the skill's permissions. In an agent-skill context, undeclared secret access is dangerous because it can bypass user/operator expectations about what sensitive data the skill can read and use, especially when the skill also transmits local image data to a third-party API.
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
prompt_tokens * GEMINI_31_FLASH_IMAGE_PREVIEW_INPUT_PRICE_PER_M / 1_000_000
+ output_tokens * GEMINI_31_FLASH_IMAGE_PREVIEW_OUTPUT_PRICE_PER_M / 1_000_000
)
return prompt_tokens, output_tokens, cost
def retry_summary(usage_payload: dict) -> tuple[int, list[str]]:
The documentation explicitly states that original frames and masks are sent to Gemini, but it does not clearly warn users that potentially sensitive video content will leave the local environment and be transmitted to a third-party service. In a video-cleanup workflow, frames may contain confidential screens, personal notifications, or embedded identifiers, so omission of a privacy/data-sharing warning can lead to unintentional disclosure.
This markdown file applies to SQP-2, and it states that the script executes an external command for each frame. The document explains the contract but does not warn users that arbitrary provider commands will be run repeatedly, which can affect system integrity or invoke untrusted tooling.
The script sources a generated env file from the workdir directly into the current shell with source "$RUN_ADVICE_ENV". Even though the file is produced by a helper script, it is treated as executable shell syntax rather than parsed as data, so any compromise of that file path, helper script, or workdir contents can lead to arbitrary command execution in the context of the user running the skill. In a media-processing skill, this behavior is broader than necessary and increases risk substantially.
In gemini-nano-banana mode, the script extracts frames from the input video and invokes an API-backed editor using GEMINI_API_KEY, which can transmit video frames to an external service. The script does not present an explicit user-facing warning, confirmation, or privacy notice at the point of execution, so sensitive screen recordings or videos could be exfiltrated off-device unexpectedly. Because this skill is specifically for cleaning screen recordings and overlays, the content is especially likely to contain sensitive notifications, status bars, or other private UI elements.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
temp_dir = Path(tempfile.mkdtemp(prefix="gemini-mask-"))
converted = temp_dir / "mask.png"
subprocess.run(
[
"ffmpeg",
"-y",
The skill accepts an arbitrary external command template at runtime and applies it across a batch of files, which exceeds the narrowly described overlay-removal function. This broad execution surface means a user or upstream agent can turn the skill into a general-purpose command runner, enabling destructive actions, data access, or network-capable tooling unrelated to frame restoration.
The script is designed to execute externally supplied commands but provides no built-in safety barrier, warning, or trust restriction around that capability. While this is partly a product-safety issue rather than a code-injection bug by itself, in an agent setting it increases the chance that unsafe commands are passed through and executed without scrutiny.
The script executes a runtime-supplied command template via subprocess after only tokenizing it with shlex.split. This allows the caller to run any local program against every frame, which is effectively arbitrary command execution within the privileges of the process. In the context of an agent skill, that is dangerous because the skill's stated purpose is video cleanup, but the implementation can be repurposed to execute unrelated system commands.
usage_output=str(usage_path) if usage_path else "",
)
try:
subprocess.run(shlex.split(command), check=True)
except subprocess.CalledProcessError as exc:
raise SystemExit(
f"Frame editor failed on frame {frame.name} with exit code {exc.returncode}: {command}"
This code persists multiple files to disk, including run_summary.json, self_improve.md, and an optional persistent learnings file. Those outputs include resolved filesystem paths, frame statistics, and estimated spend, but the script provides no confirmation prompt or explicit user-facing warning before creating or updating them.
No suspicious patterns detected.