Model Supply-Chain Security
Treat weights, tokenizers, configs, adapters, and packages as executable-adjacent inputs. Enforce `safetensors` over `pickle`, disable unreviewed `trust_remote_code`, pin repository revisions and SHA-256 hashes, and generate automated SBOMs (`D12`).
Module detail
Best time to learn: After the original roadmap's Docker, dependency hygiene, and deployment fundamentals (Weeks 7--8). Learn a short provenance primer before using any external model checkpoint in a project; complete this module during the advanced supplement.
Prerequisites - Python environments and package/dependency management. - Docker image and deployment basics. - Familiarity with Hugging Face model repositories and model loading. - Basic hashes, signatures, and software supply-chain concepts.
### Threat model
A model artifact is executable-adjacent, high-impact input to your system. The supply chain includes weights, tokenizer files, configuration, custom model code, adapters, datasets, evaluation assets, packages, and the infrastructure that downloads and stores them.
Study: - Unsafe model serialization and deserialization. - safetensors and the limits of choosing a safer weight format. - pickle-based loading risks and arbitrary code execution hazards. - trust_remote_code and custom repository code. - Model and dataset repository impersonation or compromise. - Weight, tokenizer, configuration, and adapter substitution. - Dependency confusion, typosquatting, compromised packages, and transitive dependencies. - Provenance, checksums, signatures, immutable version pinning, and artifact inventories. - Model cards and dataset cards as useful metadata, not cryptographic proof of safety. - Scanning and review before an artifact is admitted to a production environment.
### Labs
- Artifact inventory (2h): Select one small public model. Record repository, exact revision, file list, model format, tokenizer/config files, declared dependencies, license, and provenance claims.
- Safe-loading comparison (2h): In an isolated disposable environment, compare a safe tensor loading path with an unsafe serialization example. Do not execute untrusted artifacts on your host. Explain exactly what the format does and does not protect against.
- Integrity gate (2h): Download a pinned artifact, calculate file hashes, store an approved manifest, alter a copy, and verify the gate rejects the changed artifact.
- Repository review (2h): Inspect custom model code, dependencies, install hooks, and remote-code requirements. Document why each permission is needed or reject the artifact.
- Admission control (2h): Add a model-artifact approval checklist to one project. Record source, revision, hashes, license, reviewer, scan results, and deployment version.
### Project integration
- Project 1: Pin the Ollama model identifier/version where possible; record provider/runtime/model configuration. If using downloaded Hugging Face artifacts, use a pinned revision and a controlled cache.
- Project 2: Add approved model and embedding-model manifests. Prevent silent model changes from invalidating evaluation baselines.
- Deployment: Keep model files separate from application code, use read-only mounts where possible, and run model-loading processes with minimal filesystem and network permissions.
### Measurable completion criteria
- You can explain why
safetensorsreduces a particular class of deserialization risk but does not prove that weights are benign.
- Every model artifact used in the project has a recorded source and pinned revision or version.
- An integrity test detects a modified artifact.
- Unreviewed custom model code is not executed by default.
- You can produce an artifact inventory and explain its residual risks.
Do not overreach: Do not attempt to build a universal model malware scanner. Artifact provenance, safe loading, isolation, and admission controls are the target.
------------------------------------------------------------------------
Study days for this domain
14- 1Set up the development environmentW1S0S1M1R06 R39
- 3Study Python typesW1S0M1R01 R10
- 4LLM Internals & Token BudgetsW1S1S7M1R01 R04 R07 R11
- 15Study embeddings, semantic similarity, chunking, and vector…W3S4M1D12R11 R13
- 16Study model serialization risksW3M1D12R11 R12
- 17Artifact Pinning & Hash GateW3S4M1D12R12 R13 R37 R39
- 32Study MCP tool poisoning and metadata changesW6S3M1D2R05 R21
- 49Add container scanning and model-artifact inventory to the…W9M1M8D12R25 R36 R37
- 75Review Project 1 provider abstractionW13M1M4R06 R11 R12
- 82Review model/embedding/reranker provenanceW14M1M2D12R11 R12 R37
- 91Authorization & Isolation Red TeamingW16S0S4M1D2D3D4D5D7D10D11D12R02 R03 R05 R11 R13 R21 R24 R37
- 95Drill 1: Compromised Credential / Delegated TokenW16S6M1D7D8D11D12R11 R22 R23 R37
- 100Build a third-party inventoryW17S11M1D12R36 R37 R43 R44
- 103Revisit the weakest model supply-chain controlW18M1D12R11 R12 R36 R37