T09 · Insecure Skill Coding Practices
- Location
scripts/image_labeling_minimal.py:47- Finding
Reusable OSS credentials are delegated to the managed inference service
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is purpose-aligned for Alibaba Cloud video/image pipelines, but it has review-worthy risks around reusable cloud credentials, unsafe path handling, and unguarded table overwrites.
Install only after reviewing the scripts against your cloud security requirements. Use dedicated, least-privilege OSS and ODPS identities; prefer short-lived or prefix-scoped read-only credentials for AI FUNC image fetches; do not point VIDEO_INPUT_TABLE, FRAME_OUTPUT_TABLE, or OUTPUT_TABLE at shared production tables; and add canonical path checks plus explicit overwrite/truncate confirmation before running on real datasets.
scripts/image_labeling_minimal.py:47Reusable OSS credentials are delegated to the managed inference service
scripts/frame_extraction_minimal.py:55Prefix-only OSS path validation permits traversal outside the mounted root
scripts/build_video_meta.py:108Unconditional truncation can erase an unrelated ODPS table
The skill contains contradictory security guidance: it forbids emitting OSS access keys, then later requires inline access_key_id and access_key_secret for AI FUNC image fetches. This inconsistency can cause generated code to propagate long-lived credentials into job code, logs, notebooks, or tables, creating a direct secret-exposure path and undermining the earlier safety rule.
The skill describes capabilities that inherently touch environment variables, local/file reads, and shell-driven ffmpeg execution, but it declares no explicit tool scope or permission boundary. In an agent setting, missing scope declarations increase the chance that the runtime grants broader access than necessary, weakening least-privilege controls and making misuse or accidental overreach harder to prevent or audit.
The markdown instructs the agent to pass OSS access keys inline to ContentPart.image(..., storage_options=...) without an explicit warning about the sensitivity of those credentials or constraints on where they may appear. In practice, this encourages secret material to be embedded in generated code and possibly exposed through logs, prompts, notebooks, code review, or artifact retention.
The verification section reinforces the same insecure credential pattern by requiring inline OSS credentials for image fetches, normalizing secret embedding as a compliance condition for outputs. Because this appears in a verification checklist, it is especially dangerous: downstream generators may treat secret inlining as mandatory and reproduce the pattern consistently across produced jobs.
The document repeatedly states that the script 'creates if missing, then truncates' the destination ODPS table and later says it 'truncates before writing,' but it does not present this as a prominent destructive-operation warning at setup time. In an operational skill, that can lead users to point the job at an existing shared table and unintentionally erase production data, especially because this Stage 0 script is meant to be run manually or on schedulers outside stronger pipeline guardrails.
This is a markdown file, so SQP-2 applies to omitted warnings in the skill description. The document instructs users to execute md.to_odps_table(..., overwrite=True) and elsewhere explains that JPEGs are written under <OSS_ROOT>/frames/..., but it does not clearly warn that running this flow modifies storage and may overwrite existing table contents.
The documented code derives local_video_path by string replacement and then passes it to ffprobe/ffmpeg without first verifying that video_path actually starts with OSS_ROOT/. If an attacker or malformed input supplies a path outside the intended OSS prefix, the job may read unexpected mounted files or process unintended tenant data, which is especially risky in a data pipeline that shells out to local-file tools over a shared mount.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
video_dir, video_name = video_path.rsplit("/", 1)
video_basename = video_name.rsplit(".", 1)[0]
probe = subprocess.run(
[
"ffprobe", "-v", "error",
"-show_entries", "format=duration",
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
video_dir, video_name = video_path.rsplit("/", 1)
video_basename = video_name.rsplit(".", 1)[0]
probe = subprocess.run(
[
"ffprobe", "-v", "error",
"-show_entries", "format=duration",
The ffmpeg call processes attacker-influenced media paths and writes output files under a shared mount with -y overwrite enabled. While this is not shell injection, ffmpeg is a complex native parser with a long history of parser bugs, and untrusted input combined with file-writing behavior can lead to denial of service, unsafe overwrites, or exploitation if the runtime is not isolated.
if not math.isfinite(duration) or duration <= 0:
raise ValueError("invalid_duration")
ff = subprocess.run(
[
"ffmpeg", "-y",
"-i", local_video_path,
The script runs ffmpeg via subprocess and uses the -y flag, which forces overwriting generated frame files under the mounted OSS path. While this behavior is part of frame extraction, there is no explicit warning in comments or the docstring that external tools will execute and write or overwrite files in shared storage.
Untrusted video-derived paths are fed into ffmpeg, a native binary that parses complex media formats and writes derived files. Even without shell injection, this expands the attack surface to parser vulnerabilities and resource exhaustion, especially in a driving-video pipeline that may ingest large amounts of externally sourced footage.
if not math.isfinite(duration) or duration <= 0:
raise ValueError("invalid_duration")
ff = subprocess.run(
[
"ffmpeg", "-y",
"-i", local_video_path,
The script reads long-lived OSS access keys from environment variables and passes them inline via storage_options to a remote inference path so another service can fetch the images. This expands the trust boundary and creates credential exposure risk through service-side logging, debugging, misconfiguration, or unintended reuse; in an ADAS/driving-image pipeline, those credentials may also grant broad access to sensitive image buckets.
The labeling and embedding calls send image URLs and associated driving-scene data to a remote model inference service, but the script provides no runtime warning, consent gate, or data-classification check. In this skill context, the images may contain roadway scenes, license plates, faces, location-linked telemetry, or proprietary fleet data, so silent external transmission can violate privacy, contractual, or data-sovereignty requirements.
md.to_odps_table(result, OUTPUT_TABLE, overwrite=True).execute() performs a destructive write that can replace existing table contents. There is no confirmation prompt or user-facing warning immediately before this irreversible operation.
The manifest narrows the skill to video/image pipelines and explicitly says 'Not for audio'. The rest of the file consistently focuses on video/image processing, but references to in-car/cabin/dashcam workflows could encompass media sources containing audio without any explicit exclusion or stripping behavior; this is a mild intent ambiguity rather than a code-backed expansion.
This markdown file documents required environment variables including access keys and secrets such as ODPS_ACCESS_KEY and OSS_ACCESS_KEY_SECRET, but it does not warn users that these are sensitive credentials that must be stored securely and not logged or shared. For markdown files, SQP-2 applies when the skill description omits warnings about behaviors affecting user data, privacy, or system integrity.
The code accesses ODPS credentials directly from environment variables, which is a sensitive operation under the missing-warning criteria for code files. Although the module docstring lists the required variables, it does not warn that credential material will be consumed to authenticate against external services.
No suspicious patterns detected.