Skip to content
Quantoros

Is loading a downloaded sklearn joblib file safe because it is only a model, not a script?

Classic MLLevel: IntermediateUntrusted model loading

Is loading a downloaded sklearn joblib file safe because it is only a model, not a script?

Hints
  • Serialization can encode behavior.
  • File type is not a trust guarantee.

Answer

No. Pickle-based formats can execute arbitrary code during loading. Only load trusted artifacts in appropriate environments; inspect safer persistence options rather than treating a filename as a security boundary.

Source and licence: scikit-learn 1.7.2 — model persistence · BSD-3-Clause · answer: Quantoros editorial

Related questions