T08 · Insecure Dependencies
- Location
scripts/recognize.py:8- Finding
Unpinned Dependencies and Unverified Model Downloads
- Content
View full analysis
Vulnerability Details
File Location:
scripts/recognize.py:8-8,scripts/recognize.py:18-18,scripts/recognize.py:35-35,scripts/recognize.py:47-52,SKILL.md:37-50,SKILL.md:63-63
Vulnerability Type: T08: Insecure Dependencies
Risk Level: MediumVulnerable Code
scripts/recognize.py:python # Dependencies: # pip install torch transformers soundfilepython # Use a mirror to resolve network problems os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'python if sr != 16000: import resampy audio = resampy.resample(audio, sr, 16000)python model_name = f'openai/whisper-{model_size}' print(f'Loading {model_size} model...') processor = WhisperProcessor.from_pretrained(model_name) model = WhisperForConditionalGeneration.from_pretrained(model_name) feature_extractor = WhisperFeatureExtractor.from_pretrained(model_name)SKILL.md:python import os os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com' from transformers import WhisperForConditionalGeneration, WhisperProcessor, WhisperFeatureExtractor import soundfile as sf processor = WhisperProcessor.from_pretrained('openai/whisper-tiny') model = WhisperForConditionalGeneration.from_pretrained('openai/whisper-tiny') feature_extractor = WhisperFeatureExtractor.from_pretrained('openai/whisper-tiny')bash pip install torch transformers soundfileTechnical Analysis
The installation instructions resolve
torch,transformers, andsoundfilewithout pinned versions or package hashes. Dependency resolution can therefore select different releases over time, and the exact code installed by users cannot be reproduced or verified against the audited project.The executable also imports
resampywhen input audio does not use a 16-kHz sample rate, but this package is absent from the documented installation command. Users attempting to resolve the resu ...[truncated 3152 chars]- Remediation
View remediation
Remediation Suggestions
- Create a lock file or fully pinned requirements file covering all direct and transitive dependencies, including
resampy. - Require package hashes during installation, such as with
pip install --require-hashes -r requirements.txt. - Generate and review the lock file from a trusted package index in a controlled build environment.
- Avoid unconditionally replacing
HF_ENDPOINT. Prefer the official Hugging Face endpoint or a controlled internal artifact registry whose synchronization and integrity controls are documented. - Pin the model to an audited immutable commit revision:
python MODEL_REVISION = "<audited-commit-hash>" processor = WhisperProcessor.from_pretrained( model_name, revision=MODEL_REVISION, ) model = WhisperForConditionalGeneration.from_pretrained( model_name, revision=MODEL_REVISION, use_safetensors=True, ) feature_extractor = WhisperFeatureExtractor.from_pretrained( model_name, revision=MODEL_REVISION, ) - Pre-download model artifacts during a controlled installation step, verify them against documented SHA-256 checksums, and use
local_files_only=Trueduring normal transcription. - Keep remote custom model code disabled and prefer
safetensorsweights where available. - Correct the offline-use claim. Clearly disclose any first-run network access, the destination contacted, the approximate download size, and how users can deploy verified artifacts for fully offline operation.
- Run dependency and model processing inside a least-privileged environment or container with restricted filesystem and network access.
- Create a lock file or fully pinned requirements file covering all direct and transitive dependencies, including
