From 780b6cdec9ac43cae8da66527334d5dad7c08ff7 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Mon, 25 Aug 2025 16:13:56 +0800 Subject: [PATCH] fix: Optimize decryption implementation (#10130) --- agent/utils/encrypt/encrypt.go | 5 +++++ core/utils/encrypt/encrypt.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/agent/utils/encrypt/encrypt.go b/agent/utils/encrypt/encrypt.go index 6130fceaf..9a48e493f 100644 --- a/agent/utils/encrypt/encrypt.go +++ b/agent/utils/encrypt/encrypt.go @@ -69,6 +69,11 @@ func StringDecryptWithBase64(text string) (string, error) { } func StringDecryptWithKey(text, key string) (string, error) { + defer func() { + if r := recover(); r != nil { + global.LOG.Errorf("A panic occurred during string decrypt with key, error message: %v", r) + } + }() if len(text) == 0 { return "", nil } diff --git a/core/utils/encrypt/encrypt.go b/core/utils/encrypt/encrypt.go index f42269ac0..2a8539576 100644 --- a/core/utils/encrypt/encrypt.go +++ b/core/utils/encrypt/encrypt.go @@ -70,6 +70,11 @@ func StringDecrypt(text string) (string, error) { } func StringDecryptWithKey(text, key string) (string, error) { + defer func() { + if r := recover(); r != nil { + global.LOG.Errorf("A panic occurred during string decrypt with key, error message: %v", r) + } + }() if len(text) == 0 { return "", nil }