T08 · Insecure Dependencies
- Location
scripts/ensure_package.py:30- Finding
Import-Time Installation of Unpinned Third-Party Dependencies
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill can generate MeloTTS metadata, but it also automatically modifies Python environments and downloads large unpinned dependencies in ways users are not clearly asked to approve.
Review before installing. Use only in an isolated disposable environment, expect network downloads and large package/model installs, avoid sensitive audio or transcript folders unless you accept local processing, and inspect generated metadata.list for malformed or injected records. Do not run it in a shared Python environment without pinning and reviewing dependencies first.
scripts/ensure_package.py:30Import-Time Installation of Unpinned Third-Party Dependencies
scripts/config.py:36Shared Virtual Environment Is Modified with Excessive Unpinned Dependencies
scripts/generate_metadata_list.py:79Unescaped Transcript and Speaker Fields Permit Metadata Record Injection
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
venv/
ENV/
env/
.env
# Logs
logs/*.log
Automatic virtual environment creation, GPU/CUDA probing, PyTorch variant installation, and process re-execution are all powerful host-level behaviors unrelated to the narrow user-facing description. These actions can modify the system state, pull large external dependencies, and create opaque execution paths that make review and containment much harder.
Automatic virtual environment creation, GPU/CUDA probing, PyTorch variant installation, and process re-execution are all powerful host-level behaviors unrelated to the narrow user-facing description. These actions can modify the system state, pull large external dependencies, and create opaque execution paths that make review and containment much harder.
Automatic virtual environment creation, GPU/CUDA probing, PyTorch variant installation, and process re-execution are all powerful host-level behaviors unrelated to the narrow user-facing description. These actions can modify the system state, pull large external dependencies, and create opaque execution paths that make review and containment much harder.
Automatic virtual environment creation, GPU/CUDA probing, PyTorch variant installation, and process re-execution are all powerful host-level behaviors unrelated to the narrow user-facing description. These actions can modify the system state, pull large external dependencies, and create opaque execution paths that make review and containment much harder.
The file implements a generic package installer rather than MeloTTS metadata generation, which is a strong capability mismatch. Such hidden or unrelated functionality is dangerous because it expands the skill's privileges and attack surface beyond what users and reviewers would reasonably expect.
The module mutates the environment on import by reinstalling packaging-related components before any business logic runs. Import-time side effects are especially dangerous because they trigger automatically, are hard for callers to anticipate, and can alter or break unrelated workloads while exposing the host to package-supply-chain risk.
This section can install arbitrary packages from remote repositories and local archives, including git and zip sources, with minimal restriction. In a skill whose declared purpose is metadata file generation, this is unjustified and significantly more dangerous because it enables supply-chain compromise and arbitrary code execution through dependency installation.
Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.
sys.exit(1)
# 传递环境变量防止递归
env = os.environ.copy()
env["RUNNING_IN_VENV"] = "true"
logger.info(f" 当前Python: {sys.executable}")
The README advertises automatic Whisper transcription, model download to ./models/, and output file generation while downplaying operational side effects by stating failures are skipped automatically. In practice, this implies network access, local disk writes, and processing of potentially sensitive audio/text data without prominent warnings or consent guidance, which can lead to unintended privacy exposure or unauthorized environment changes.
The README includes broad natural-language trigger phrases such as '帮我生成 MeloTTS 的 metadata.list' and similar variants without clearly constraining required paths, confirmation steps, or scope. In an agent setting, this can cause the skill to activate on ambiguous user requests and perform filesystem scanning, transcription, or file generation on unintended directories, increasing the risk of overbroad actions and accidental data processing.
The skill declares only a minimal binary requirement while the documented behavior invokes shell execution, reads user-supplied directories, and writes output files. Without an explicit tool/permission scope, the runtime may grant broader-than-necessary capabilities, increasing the chance of unintended file access or command execution abuse if parameters are manipulated or future code expands behavior.
The natural-language content of the skill is written entirely in Chinese and does not indicate that users may interact in other languages or opt into this locale. Under the policy, forcing a specific language without user choice is a natural-language policy violation unless the constraint is clearly justified as region-specific.
The documentation openly describes the module as an intelligent package installer, contradicting the skill manifest's claimed MeloTTS metadata-only behavior. This mismatch is a security concern because it signals undeclared capabilities and reduces reviewer/operator ability to make informed trust decisions.
Performing package installation and environment modification at import time without confirmation is unsafe operational behavior. It can surprise users, violate least astonishment, and lead to unwanted code installation or breakage simply from loading the skill.
This subprocess call invokes pip to modify the Python environment and is executed from a helper that is called at module import time. That means merely importing this file triggers package installation without user consent, creating unexpected network activity and supply-chain exposure if package resolution is compromised.
"""专门为老项目(使用 pkg_resources 的 setup.py)修复 setuptools 版本"""
try:
# 先强制修复损坏的 packaging 包(关键!解决无RECORD文件报错)
subprocess.check_call([
sys.executable, "-m", "pip", "install",
"--verbose", "--ignore-installed", "--no-deps", "packaging==26.1"
])
This call force-reinstalls setuptools and wheel, mutating core packaging infrastructure as soon as the module is imported. Altering foundational tooling automatically can destabilize the host environment and increases the blast radius of any package-supply-chain issue.
"--verbose", "--ignore-installed", "--no-deps", "packaging==26.1"
])
# 再安装兼容的 setuptools + wheel
subprocess.check_call([
sys.executable, "-m", "pip", "install",
"--verbose", "--force-reinstall", "setuptools<=81.2.0", "wheel"
])
Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.
# 第一步:尝试 import 检查(最快)
try:
parts = import_name.split('.')
mod = __import__(parts[0])
for part in parts[1:]:
mod = getattr(mod, part)
if sub_import:
This subprocess call executes a pip install command built from the caller-controlled spec value, supporting arbitrary package names, git URLs, and archive paths. In the context of a MeloTTS metadata generator, this capability is unrelated to the declared function and enables remote code introduction and environment compromise through untrusted dependency sources.
cmd.extend(["-i", "https://pypi.tuna.tsinghua.edu.cn/simple"])
try:
subprocess.check_call(cmd)
logger.info(f"✅ {spec} 安装/升级完成!")
except subprocess.CalledProcessError as e:
The fallback installation path executes pip against a local zip archive whose path is supplied at runtime. Installing arbitrary local archives can execute untrusted build/install code and bypass normal dependency review, making this a high-risk code introduction mechanism.
sys.executable, "-m", "pip", "install",
"--upgrade", fallback_zip, "--verbose"
]
subprocess.check_call(cmd_fallback)
logger.info(f"✅ 使用本地包 {fallback_zip} 安装成功!")
return
except subprocess.CalledProcessError as e2:
Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.
# ==================== 1. 检查是否已安装 + 版本是否满足 ====================
try:
__import__(import_name)
# 尝试获取当前版本
try:
This helper installs an arbitrary package string with optional version constraints at runtime, again mutating the environment from within the skill. Even though it targets PyPI rather than git explicitly, it still expands the trusted computing base and can install unsafe or typosquatted packages outside the skill's stated scope.
logger.warning(f"🔧 正在安装 {install_str} ...")
try:
subprocess.check_call([
sys.executable, "-m", "pip", "install",
install_str,
"-i", "https://pypi.tuna.tsinghua.edu.cn/simple",
The file's natural-language description and many runtime messages are written only in Chinese, with no indication that the skill is region-specific or that users may select another language. Per the policy, forcing a specific language without opt-in is a natural-language policy violation.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def is_torch_gpu_installed(python_exe):
"""检测虚拟环境中是否安装了 GPU 版本 PyTorch"""
try:
result = subprocess.run(
[str(python_exe), "-c",
"import torch; print(torch.version.cuda or 'cpu')"],
capture_output=True, text=True, timeout=10
This bootstrapper performs broad environment setup, GPU probing, and multiple package installations that exceed the manifest's narrowly described role of generating MeloTTS metadata files. Such overbroad behavior is dangerous because it silently mutates the host, adds network/package trust dependencies, and increases the chance that the skill is used as an unexpected installer rather than a simple file-generation tool.
No suspicious patterns detected.