From d89e26cd891d02d0475e277ae072f000ea23493a Mon Sep 17 00:00:00 2001 From: Yabets Mebratu Date: Sun, 31 May 2026 13:31:06 -0700 Subject: [PATCH] fix(B324): add usedforsecurity=False to MD5 hash calls in cache.py and query_editor.py --- libs/core/garf/core/cache.py | 4 ++-- libs/core/garf/core/query_editor.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/core/garf/core/cache.py b/libs/core/garf/core/cache.py index 587742d2..6f839a06 100644 --- a/libs/core/garf/core/cache.py +++ b/libs/core/garf/core/cache.py @@ -83,7 +83,7 @@ def load( """ args_hash = args.hash if args else '' kwargs_hash = ( - hashlib.md5(json.dumps(kwargs).encode('utf-8')).hexdigest() + hashlib.md5(json.dumps(kwargs).encode('utf-8'), usedforsecurity=False).hexdigest() if kwargs else '' ) @@ -117,7 +117,7 @@ def save( self.location.mkdir(parents=True, exist_ok=True) args_hash = args.hash if args else '' kwargs_hash = ( - hashlib.md5(json.dumps(kwargs).encode('utf-8')).hexdigest() + hashlib.md5(json.dumps(kwargs).encode('utf-8'), usedforsecurity=False).hexdigest() if kwargs else '' ) diff --git a/libs/core/garf/core/query_editor.py b/libs/core/garf/core/query_editor.py index 6c59eba4..dbfbe73d 100644 --- a/libs/core/garf/core/query_editor.py +++ b/libs/core/garf/core/query_editor.py @@ -45,7 +45,7 @@ class GarfQueryParameters(pydantic.BaseModel): @property def hash(self) -> str: hash_fields = self.model_dump(exclude_none=True) - return hashlib.md5(json.dumps(hash_fields).encode('utf-8')).hexdigest() + return hashlib.md5(json.dumps(hash_fields).encode('utf-8'), usedforsecurity=False).hexdigest() def __eq__(self, other) -> bool: return (self.macro, self.template) == (other.macro, other.template) @@ -121,7 +121,7 @@ def request(self) -> str: @property def hash(self) -> str: hash_fields = self.model_dump(exclude_none=True, exclude={'title', 'text'}) - return hashlib.md5(json.dumps(hash_fields).encode('utf-8')).hexdigest() + return hashlib.md5(json.dumps(hash_fields).encode('utf-8'), usedforsecurity=False).hexdigest() class CommonParametersMixin: