Restrict backend key unpickling#329
Open
dipeshbabu wants to merge 2 commits into
Open
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #329 +/- ##
=========================================
Coverage ? 72.94%
=========================================
Files ? 22
Lines ? 2828
Branches ? 0
=========================================
Hits ? 2063
Misses ? 765
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dipeshbabu
force-pushed
the
agent/restrict-backend-key-unpickling
branch
from
July 22, 2026 05:39
ccdc4e0 to
a4cb2a7
Compare
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.
What
Route synchronous and asynchronous LSH key serialization through a restricted loader that rejects global construction opcodes, persistent IDs, and non-hashable results. Validate keys before insertion and document the supported key types and migration impact.
Why
Redis and other external backends can return tampered bytes. Passing those bytes to the standard pickle loader can invoke attacker-selected global callables during a query.
Impact
Primitive built-in keys continue to round-trip. Custom class keys now fail before insertion, and existing indexes using them must migrate to supported built-in values. Malicious or corrupt backend values raise an unpickling error without executing their payload.
Root cause
Backend data was treated as trusted and decoded with unrestricted pickle.loads calls.
Checks