Model loaded in a way that can run code
Gaphigh severity · reads .py .ipynbBeta
A model checkpoint saved with pickle can carry code that runs the moment it is loaded, and trust_remote_code=True runs Python from the model's repository on your server (CWE-502). Since PyTorch 2.6, torch.load loads weights only by default, so a plain call is Partial: it depends on your PyTorch version. When Lintsure finds this, it marks it as a Gap: the code itself shows the problem.
What it looks like
A line Lintsure flags in its own test app:
// src/model.py
state = torch.load("checkpoint.pt", weights_only=False)How to fix it
Load weights only: torch.load(path, weights_only=True), or use safetensors. Don't pass trust_remote_code=True; if a model needs it, pin the exact revision you reviewed.
Through a coding agent, Lintsure suggests the change and waits. Nothing is edited until you approve it.
Controls it relates to
- OWASP Top 10A08:2025Software or Data Integrity Failures
- OWASP LLM Top 10LLM04:2026Supply Chain
What the framework asks
OWASP Top 10 A08:2025: Software or Data Integrity Failures
Don't trust code or data you haven't checked: no unsafe deserialisation, integrity checks on third-party scripts, and no trust in values users can change.
Evidence a reviewer may ask for: How third-party scripts are loaded and how incoming data is parsed.
OWASP LLM Top 10 LLM04:2026: Supply Chain
Models, datasets, plugins and packages come from others. Pin and check them like any dependency.
Evidence a reviewer may ask for: Where each model and dataset comes from, and its licence.
Summaries are our own reading of the public texts, not the official wording.
Check your code for this
Runs on your machine. Your code is never uploaded.
npx lintsure scanThis rule is in Beta: its mapping to framework controls is our own reading of the public texts, not independently reviewed. Lintsure is a readiness tool, not an audit or legal advice. A finding, or the lack of one, doesn't make you compliant. Disclaimer
We improve these rules all the time. If you see a false alarm, a missed problem or anything that could work better, tell us in a review and we will use it to improve your experience.
Related rules
- Personal data written to logs
- Secret or private key committed to source
- Data sent over plain HTTP
- Personal data or tokens in a URL
Did this rule flag something that's fine, or miss a real problem? Tell us on GitHub. Every report becomes a test case, so the same mistake can't come back.