Potential fix for code scanning alert no. 134: Use of a broken or weak cryptographic hashing algorithm on sensitive data

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
ي
2026-05-25 17:29:39 +05:30
committed by GitHub
parent cb3666dd7b
commit 56b2f3afcf

View File

@@ -79,8 +79,8 @@ class CachingService:
if kwargs: if kwargs:
key_data += ":" + json.dumps(kwargs, sort_keys=True) key_data += ":" + json.dumps(kwargs, sort_keys=True)
# Create hash for consistent key length # Create hash for consistent key length using a strong hash algorithm
key_hash = hashlib.md5(key_data.encode()).hexdigest() key_hash = hashlib.sha256(key_data.encode("utf-8")).hexdigest()
return f"content_strategy:{cache_type}:{key_hash}" return f"content_strategy:{cache_type}:{key_hash}"
except Exception as e: except Exception as e: