this post was submitted on 10 Feb 2026
26 points (88.2% liked)

Python

7816 readers
16 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

๐Ÿ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

๐Ÿ Python project:
๐Ÿ’“ Python Community:
โœจ Python Ecosystem:
๐ŸŒŒ Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS
 

It is common knowledge that pickle is a serious security risk. And yet, vulnerabilities involving that serialisation format keep happening. In the article I shortly describe the issue and appeal to people to stop using pickle.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] NostraDavid@programming.dev 0 points 1 month ago* (last edited 1 month ago) (1 children)

If you need to pickle your ML model, just use JobLib instead.

If you want to save a polars or pandas df, save files as parquet.

Both ways you can also use compression, so you'll save space as well. Use zstd if you need decent compression, or lz4 if you write and read speeds.

[โ€“] mina86@lemmy.wtf 3 points 1 month ago

Joblib has the same drawback as pickle. From the documentation:

joblib.dump() and joblib.load() are based on the Python pickle serialization model, which means that arbitrary Python code can be executed when loading a serialized object with joblib.load().

joblib.load() should therefore never be used to load objects from an untrusted source or otherwise you will introduce a security vulnerability in your program.