From 589256aff54c185008cf8bcf86a055b92fded846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8B=BE=E9=A3=8E?= <3431391539@qq.com> Date: Thu, 13 Nov 2025 20:54:42 +0800 Subject: [PATCH] Potential fix for code scanning alert no. 15: 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> --- src/common/database/utils/decorators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/database/utils/decorators.py b/src/common/database/utils/decorators.py index 2922f382e..f5cc2f04a 100644 --- a/src/common/database/utils/decorators.py +++ b/src/common/database/utils/decorators.py @@ -46,12 +46,12 @@ def generate_cache_key( if args: args_str = ",".join(str(arg) for arg in args) - args_hash = hashlib.md5(args_str.encode()).hexdigest()[:8] + args_hash = hashlib.sha256(args_str.encode()).hexdigest()[:8] cache_key_parts.append(f"args:{args_hash}") if kwargs: kwargs_str = ",".join(f"{k}={v}" for k, v in sorted(kwargs.items())) - kwargs_hash = hashlib.md5(kwargs_str.encode()).hexdigest()[:8] + kwargs_hash = hashlib.sha256(kwargs_str.encode()).hexdigest()[:8] cache_key_parts.append(f"kwargs:{kwargs_hash}") return ":".join(cache_key_parts)