Skip to content

Commit

Permalink
fix coverity hash issue in metaflow_utils file
Browse files Browse the repository at this point in the history
  • Loading branch information
rajithkrishnegowda committed Oct 25, 2024
1 parent 6aac83a commit 46a3f72
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions openfl/experimental/utilities/metaflow_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ def __init__(self, name):

def __enter__(self):
lock_id = hashlib.new(
"md5", self.name.encode("utf8"), usedforsecurity=False
"sha256", self.name.encode("utf8"), usedforsecurity=False
).hexdigest() # nosec
# MD5sum used for concurrency purposes, not security
# Using SHA-256 to address security warning
self.fp = open(f"/tmp/.lock-{lock_id}.lck", "wb")
fcntl.flock(self.fp.fileno(), fcntl.LOCK_EX)

Expand Down Expand Up @@ -345,11 +345,7 @@ def save_artifacts(self, artifacts_iter, force_v4=False, len_hint=0):

def pickle_iter():
for name, obj in artifacts_iter:
do_v4 = (
force_v4 and force_v4
if isinstance(force_v4, bool)
else force_v4.get(name, False)
)
do_v4 = force_v4 if isinstance(force_v4, bool) else force_v4.get(name, False)
if do_v4:
encode_type = "gzip+pickle-v4"
if encode_type not in self._encodings:
Expand Down

0 comments on commit 46a3f72

Please sign in to comment.