A pickle payload whose __reduce__ creates a sentinel directory. Used to prove that pickle.loads is NOT called on attacker-controlled bytes when the file-HMAC does not match.
| 93 | |
| 94 | |
| 95 | class _MaliciousPayload: |
| 96 | """A pickle payload whose __reduce__ creates a sentinel directory. |
| 97 | |
| 98 | Used to prove that pickle.loads is NOT called on attacker-controlled |
| 99 | bytes when the file-HMAC does not match. |
| 100 | """ |
| 101 | |
| 102 | sentinel_path = None # set per-test before pickling |
| 103 | |
| 104 | def __reduce__(self): |
| 105 | return (os.makedirs, (self.sentinel_path, True)) |
| 106 | |
| 107 | |
| 108 | class _SessionTestSetupMixin: |