MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / _MaliciousPayload

Class _MaliciousPayload

web/pgadmin/utils/tests/test_session_file_format.py:95–105  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

93
94
95class _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
108class _SessionTestSetupMixin:

Callers 2

runTestMethod · 0.85
runTestMethod · 0.85

Calls

no outgoing calls

Tested by 2

runTestMethod · 0.68
runTestMethod · 0.68