Start here. This is the direct spoken answer to practice first.
Overview
Explains code execution during object reconstruction and chooses data-only formats with explicit validation.
pickle can reconstruct Python objects by importing and invoking callables, so a malicious payload can execute code during unpickling. I never unpickle data from users, queues, caches, files, or databases unless its origin and integrity are fully trusted. YAML loaders that construct arbitrary Python objects have the same class of risk. For untrusted input I use a data-only format such as JSON or a safe YAML loader, then validate the resulting shape.