Expand description
Pickle opcode-stream validation ported from
guard_core/handlers/_suspatterns_pickle.py (spec 4.0.2).
The reference walks a bounded 4096-byte window through the CPython pickle
opcode dispatch (with class resolution, extension registry and persistent
loading blocked). The walk answers exactly two questions: does the prefix
before a candidate look like a valid opcode stream, and does the suffix
after it reach a REDUCE/BUILD opcode without an error.
Functionsยง
- pickle_
global_ candidate_ is_ injection _pickle_global_candidate_is_injection: the prefix before the candidate must walk as a valid opcode stream and the suffix after the class-name group must reach REDUCE or BUILD.- pickle_
prefix_ is_ opcode_ stream - pickle_
suffix_ reaches_ reduce_ or_ build