收紧微信支付能力日志边界
微信虚拟支付不可用时只记录稳定标签 补充不可用路径日志脱敏测试 更新原生壳根门禁防止能力细节泄露
This commit is contained in:
@@ -3446,6 +3446,7 @@ function assertWechatPaymentResultBoundaries() {
|
||||
'function logWechatPayFailure(label, _error)',
|
||||
'console.error(`[wechat-pay] ${label}`)',
|
||||
"logWechatPayFailure('parse params failed', error)",
|
||||
"logWechatPayFailure('requestVirtualPayment unavailable')",
|
||||
"logWechatPayFailure('requestVirtualPayment failed', error)",
|
||||
]) {
|
||||
if (!paymentSource.includes(snippet)) {
|
||||
@@ -3456,14 +3457,17 @@ function assertWechatPaymentResultBoundaries() {
|
||||
paymentSource.includes('JSON.stringify({\n errCode') ||
|
||||
paymentSource.includes('String(error.errMsg || error)') ||
|
||||
paymentSource.includes("console.error('[wechat-pay] parse params failed', error)") ||
|
||||
paymentSource.includes("console.error('[wechat-pay] requestVirtualPayment unavailable',") ||
|
||||
paymentSource.includes("console.error('[wechat-pay] requestVirtualPayment failed', error)")
|
||||
) {
|
||||
throw new Error('wechat payment bridge must not expose native payment errors to H5');
|
||||
}
|
||||
for (const snippet of [
|
||||
'maps virtual payment cancel errCode to cancel result',
|
||||
'logs virtual payment unavailable without exposing capability details',
|
||||
'hides ordinary payment native failure details from H5 result',
|
||||
"errorMessage: 'wechat payment unavailable'",
|
||||
"expect(console.error.mock.calls).toContainEqual([\n '[wechat-pay] requestVirtualPayment unavailable',",
|
||||
"expect(console.error).toHaveBeenCalledWith(\n '[wechat-pay] requestVirtualPayment failed'",
|
||||
'expect(console.error.mock.calls.flat()).not.toContain(payError)',
|
||||
]) {
|
||||
|
||||
Reference in New Issue
Block a user