diff --git a/src/Essensoft.Paylinks.WeChatPay.Client/WeChatPayNotifyClient.cs b/src/Essensoft.Paylinks.WeChatPay.Client/WeChatPayNotifyClient.cs index 0c86d13e1..8c1e0695a 100644 --- a/src/Essensoft.Paylinks.WeChatPay.Client/WeChatPayNotifyClient.cs +++ b/src/Essensoft.Paylinks.WeChatPay.Client/WeChatPayNotifyClient.cs @@ -11,6 +11,11 @@ public class WeChatPayNotifyClient(IWeChatPayPlatformCertificateManagerFactory c { public Task ExecuteAsync(WeChatPayHeaders headers, string body, WeChatPayClientOptions options) where T : IWeChatPayNotifyResource { + if (headers.Signature.StartsWith(WeChatPayConstants.SignTestPrefix)) // 签名探测流量 + { + throw new WeChatPayException("验签失败: 签名探测流量"); + } + // 验签 string certPublicKey; diff --git a/src/Essensoft.Paylinks.WeChatPay.Core/WeChatPayConstants.cs b/src/Essensoft.Paylinks.WeChatPay.Core/WeChatPayConstants.cs index 71cc21d61..9dd2cedd7 100644 --- a/src/Essensoft.Paylinks.WeChatPay.Core/WeChatPayConstants.cs +++ b/src/Essensoft.Paylinks.WeChatPay.Core/WeChatPayConstants.cs @@ -2,5 +2,6 @@ namespace Essensoft.Paylinks.WeChatPay.Core; public static class WeChatPayConstants { + public const string SignTestPrefix = "WECHATPAY/SIGNTEST/"; public const string PublicKeyIdPrefix = "PUB_KEY_ID_"; }