Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix coverity hash issue in metaflow_utils file #1106

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading