fix(security): address reported unsafe pickle.load usages#2099
Merged
SunsetWolf merged 1 commit intomainfrom Jan 28, 2026
Merged
fix(security): address reported unsafe pickle.load usages#2099SunsetWolf merged 1 commit intomainfrom
SunsetWolf merged 1 commit intomainfrom
Conversation
04661ac to
8355990
Compare
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Motivation and Context
How Has This Been Tested?
pytest qlib/tests/test_all_pipeline.pyunder upper directory ofqlib.Screenshots of Test Results (if appropriate):
Types of changes