Skip to content

Commit

Permalink
chore: Switch to sha256 from md5 to remedy CodeQL warning (#3356)
Browse files Browse the repository at this point in the history
This use of md5 doesn't appear to be a cryptographically sensitive
    context, but the easiest remediation for the CodeQL warning is to
    switch to an approved hash function.
  • Loading branch information
kdestin authored Aug 20, 2024
1 parent 6a36786 commit cb3b034
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
def get_hash(paths):
# Returns a single hash value of a list of paths (files or dirs)
size = sum(os.path.getsize(p) for p in paths if os.path.exists(p)) # sizes
h = hashlib.md5(str(size).encode()) # hash sizes
h = hashlib.sha256(str(size).encode()) # hash sizes
h.update("".join(paths).encode()) # hash paths
return h.hexdigest() # return hash

Expand Down

0 comments on commit cb3b034

Please sign in to comment.