T08 · Insecure Dependencies
Warning
- Location
- scripts/bootstrap_env.py:54
- Finding
- Unpinned Dependencies and Mutable Model Artifacts Create a Supply-Chain Risk<![CDATA[ ## Vulnerability Details **File Location**: - `scripts/bootstrap_env.py:54-57` - `scripts/bootstrap_env.py:80-98` - `scripts/install_embedding_model.py:12-28` - `scripts/install_argos_model.py:54-69` - `.github/workflows/daily-digest.yml:16-27` **Vulnerability Type**: Unpinned third-party packages, models, and CI actions **Risk Level**: Medium ### Vulnerable Code ```python # scripts/bootstrap_env.py:54-57 print("[BOOTSTRAP] Installing python packages in env...") run([conda, "run", "-n", env_name, "python", "-m", "pip", "install", "--upgrade", "pip"], cwd=root) run([conda, "run", "-n", env_name, "python", "-m", "pip", "install", "argostranslate"], cwd=root) run([conda, "run", "-n", env_name, "python", "-m", "pip", "install", "sentence-transformers"], cwd=root) ``` ```python # scripts/bootstrap_env.py:80-98 if not skip_embedding_model: print("[BOOTSTRAP] Preloading embedding model (BAAI/bge-m3)...") proc = run( [conda, "run", "-n", env_name, "python", "scripts/install_embedding_model.py", "--model", "BAAI/bge-m3"], cwd=root, check=False, ) if proc.returncode != 0: print("[BOOTSTRAP][WARN] Embedding model preload failed, will download on first run.") print("[BOOTSTRAP] Preloading reranker model (BAAI/bge-reranker-v2-m3)...") proc = run( [ conda, "run", "-n", env_name, "python", "scripts/install_embedding_model.py", "--kind", "reranker", "--model", "BAAI/bge-reranker-v2-m3", ], cwd=root, check=False, ) ``` ```python # scripts/install_embedding_model.py:12-28 parser.add_argument("--model", default="BAAI/bge-m3") parser.add_argument("--kind", default="embedding", choices=["embedding", "reranker"]) args = parser.parse_args() try: from sentence_transformers import SentenceTransformer, CrossEncoder except Exception as exc: print(f"[ERROR] sentence-transformers not available: {exc}") return 1 try: if args.kind == "e ...[truncated 3800 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Create a dependency lock file containing exact versions and cryptographic hashes for all direct and transitive Python packages. 2. Install packages with hash enforcement, for example: ```bash python -m pip install --require-hashes -r requirements.lock ``` 3. Do not upgrade `pip` implicitly during routine bootstrap. Pin and validate the required installer version separately. 4. Pin Hugging Face models to reviewed immutable commit revisions rather than floating repository heads. 5. Record and verify expected hashes for downloaded model files before loading them. 6. Select an explicit reviewed Argos package version and verify its checksum or signature before calling `install_from_path`. 7. Pin GitHub Actions to complete commit SHAs rather than `@v4` or `@v5`. 8. Reduce workflow permissions to `contents: read` by default and grant write capability only to a narrowly isolated commit step when required. 9. Consider generating digest artifacts without allowing the same dependency-processing job to push directly to the default branch. ]]>
