Skip to content

Commit

Permalink
Add hash check for pickle files (CVE-2024-24590)
Browse files Browse the repository at this point in the history
  • Loading branch information
allegroai committed Feb 9, 2024
1 parent b78e9b9 commit e506831
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions clearml/binding/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ def get(self, force_download=False, deserialization_function=None):
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:
Expand Down

0 comments on commit e506831

Please sign in to comment.