T08 · Insecure Dependencies
- Location
scripts/requirements.txt:1- Finding
Unpinned Third-Party Dependencies and Mutable Model Revisions
- Content
View full analysis
Vulnerability Details
File Location:
scripts/requirements.txt:1-4,scripts/setup.sh:57-66,scripts/download_models.py:33-49, andscripts/inference.py:62-82
Vulnerability Type: Supply-chain exposure through unpinned packages and model artifacts
Risk Level: MediumVulnerable Code
scripts/requirements.txt:1-4:text qwen-tts soundfile torch huggingface_hubscripts/setup.sh:57-66:bash # Upgrade pip first pip install --upgrade pip setuptools wheel # Install qwen-tts and dependencies echo "Installing qwen-tts (this may take several minutes)..." pip install -r scripts/requirements.txt # Download models echo "Downloading models..." python scripts/download_models.pyscripts/download_models.py:33-49:python def download_model(model_id: str, dest_dir: Path) -> bool: """Download a single model from HuggingFace Hub to *dest_dir*.""" from huggingface_hub import snapshot_download local_name = model_id.replace("/", "--") local_path = dest_dir / local_name if local_path.is_dir() and any(local_path.iterdir()): logger.info("Already present: %s -> %s", model_id, local_path) return True logger.info("Downloading %s -> %s ...", model_id, local_path) try: snapshot_download( model_id, local_dir=str(local_path), )scripts/inference.py:62-82:python model_id = MODEL_VARIANTS[variant] local_path = self._local_model_path(variant) load_source = str(local_path) if local_path else model_id logger.info( "Loading '%s' from %s on %s [%s] ...", variant, "local cache" if local_path else "HuggingFace Hub", DEVICE, DTYPE, ) load_kwargs: dict = { "device_map": DEVICE, "dtype": _resolve_dtype(), } if DEVICE.startswith("cuda") and DTYPE in ("float16", "bfloat16"): load_kwargs["attn_implementation"] = "flash_attention_2" start = time.time() self._model = Qwen3TTSModel.from_pretrained(load_source, **load_kwargs) ...[truncated 3011 chars]- Remediation
View remediation
Remediation Suggestions
- Pin every direct dependency to an exact, reviewed version.
- Generate a lockfile that captures all transitive dependencies.
- Record cryptographic hashes and install with hash verification, such as
pip install --require-hashes. - Pin
pip,setuptools, andwheelinstead of upgrading them to unconstrained latest releases. - Use a trusted package index explicitly and prevent unintended fallback to alternative indexes.
- Add automated dependency vulnerability, provenance, and license scanning to the release process.
- Pass a verified immutable commit SHA through the
revisionargument of everysnapshot_download()andfrom_pretrained()call. - Record and verify checksums for downloaded model files or manifests.
- Add an offline-only mode using
local_files_only=True, and preferably make it the default during inference after explicit setup. - Fail closed when an expected local model is missing rather than silently retrieving a mutable remote revision.
- Review model artifact formats and disable loading mechanisms that can deserialize arbitrary Python objects.
- Document the exact package lockfile, model commit identifiers, checksums, and update-review procedure required to reproduce an audited installation.
