mirror of
https://github.com/clearml/clearml
synced 2025-01-31 00:56:57 +00:00
Add hash check for pickle files (CVE-2024-24590)
This commit is contained in:
parent
b78e9b9047
commit
e506831599
@ -203,6 +203,10 @@ class Artifact(object):
|
||||
with open(local_file, "rt") as f:
|
||||
self._object = f.read()
|
||||
elif self.type == "pickle":
|
||||
if self.hash:
|
||||
file_hash, _ = sha256sum(local_file, block_size=Artifacts._hash_block_size)
|
||||
if self.hash != file_hash:
|
||||
raise Exception("incorrect pickle file hash, artifact file might be corrupted")
|
||||
with open(local_file, "rb") as f:
|
||||
self._object = pickle.load(f)
|
||||
except Exception as e:
|
||||
|
Loading…
Reference in New Issue
Block a user