Skip to content

fix(security): address reported unsafe pickle.load usages#2099

Merged
SunsetWolf merged 1 commit intomainfrom
security/restrict-pickle-deserialization-followup
Jan 28, 2026
Merged

fix(security): address reported unsafe pickle.load usages#2099
SunsetWolf merged 1 commit intomainfrom
security/restrict-pickle-deserialization-followup

Conversation

@SunsetWolf
Copy link
Collaborator

Description

Motivation and Context

How Has This Been Tested?

  • Pass the test by running: pytest qlib/tests/test_all_pipeline.py under upper directory of qlib.
  • If you are adding a new feature, test on your own test scripts.

Screenshots of Test Results (if appropriate):

  1. Pipeline test:
  2. Your own tests:

Types of changes

  • Fix bugs
  • Add new feature
  • Update documentation
@SunsetWolf SunsetWolf force-pushed the security/restrict-pickle-deserialization-followup branch 2 times, most recently from 04661ac to 8355990 Compare January 28, 2026 14:11
@SunsetWolf SunsetWolf merged commit 39634b2 into main Jan 28, 2026
233 of 279 checks passed
@SunsetWolf SunsetWolf deleted the security/restrict-pickle-deserialization-followup branch January 28, 2026 14:19
universeplayer pushed a commit to universeplayer/qlib that referenced this pull request Mar 1, 2026
…lization

The RestrictedUnpickler introduced in microsoft#2099 whitelisted only a few specific
qlib classes (DataHandler, DataHandlerLP, StaticDataLoader) but missed many
others such as Alpha158, Alpha360, and various contrib handlers/models. This
caused UnpicklingError during rolling train when task definitions containing
these class references were deserialized from MongoDB.

Instead of maintaining an ever-growing list of individual qlib classes, add
"qlib" as a trusted module prefix alongside "pandas" and "numpy". All qlib
internal classes are safe to deserialize within qlib's own restricted
unpickler since they are part of the framework itself. The three individual
qlib entries in SAFE_PICKLE_CLASSES are removed as they are now redundant.

Fixes microsoft#2130

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant