Skip to content

Commit

Permalink
Merge pull request #7906 from EricSoroos/7768_md5
Browse files Browse the repository at this point in the history
Note that MD5 Hash is not used for security purposes
  • Loading branch information
wardi committed Nov 16, 2023
2 parents 7c3d085 + ae2ccc6 commit e2e5de2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes/7906.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Note that md5 use in tracking is not a security context
4 changes: 3 additions & 1 deletion ckanext/tracking/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def track_request(response: Response) -> Response:
request.environ.get('HTTP_ACCEPT_LANGUAGE', ''),
request.environ.get('HTTP_ACCEPT_ENCODING', ''),
])
key = hashlib.md5(key.encode()).hexdigest()
# raises a type error on python<3.9
h = hashlib.new('md5', usedforsecurity=False) # type: ignore
key = h.update(key.encode()).hexdigest()
# store key/data here
sql = '''INSERT INTO tracking_raw
(user_key, url, tracking_type)
Expand Down

0 comments on commit e2e5de2

Please sign in to comment.