{"record":{"id":"f03cd370484a067b","repo":"jeecgboot/JeecgBoot","slug":"sign-message","errorCode":null,"errorMessage":"Sign签名校验失败：{message}","messagePattern":"Sign签名校验失败：(.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/sign/interceptor/SignAuthInterceptor.java","lineNumber":132,"sourceCode":"                }\n            }\n\n            //2.校验签名\n            boolean isSigned = SignUtil.verifySign(allParams,headerSign);\n\n            if (isSigned) {\n                log.debug(\"签名验证通过\");\n            } else {\n                log.error(\"签名验证失败, 参数: {}\", allParams);\n                throw new IllegalArgumentException(\"Sign签名校验失败！\");\n            }\n        } catch (IllegalArgumentException e) {\n            // 重新抛出签名验证异常\n            throw e;\n        } catch (Exception e) {\n            // 包装其他异常（如IOException）\n            log.error(\"签名验证异常: {}\", e.getMessage());\n            throw new IllegalArgumentException(\"Sign签名校验失败：\" + e.getMessage());\n        }\n    }\n\n}\n","sourceCodeStart":114,"sourceCodeEnd":137,"githubUrl":"https://github.com/jeecgboot/JeecgBoot/blob/96fb33f5ec68516da0b0147da06b2eb0419e063a/jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/sign/interceptor/SignAuthInterceptor.java#L114-L137","documentation":"This is a catch-all wrapper for any unexpected exception during signature validation that is not an IllegalArgumentException. It concatenates 'Sign签名校验失败：' with the original exception message. This fires when the validation logic encounters an IOException (failed BodyReaderHttpServletRequestWrapper body re-read), a NumberFormatException (invalid X-TIMESTAMP value), or any other runtime exception.","triggerScenarios":"X-TIMESTAMP contains a non-numeric value causing NumberFormatException at Long.parseLong (line 89). The request body has already been consumed by another filter, causing BodyReaderHttpServletRequestWrapper to fail. HttpUtils.getAllParams throws an IOException while reading the body. SpringContextUtils.getBean(JeecgBaseConfig.class) fails during SignUtil.getSignatureSecret().","commonSituations":"Client sends X-TIMESTAMP=NaN or a date string instead of a number. A filter upstream consumed the InputStream without wrapping it. The application context is not fully initialized when the interceptor fires. A malformed multipart request body.","solutions":["Ensure X-TIMESTAMP is a valid numeric string (either 14-digit yyyyMMddHHmmss or 13-digit Unix ms).","Verify no upstream filter consumes the request body without wrapping it in a BodyReaderHttpServletRequestWrapper.","Check server logs for the specific wrapped exception message (the getMessage() portion after the colon) to identify the root cause.","If the error is from SpringContextUtils, verify the JeecgBaseConfig bean is properly configured and loaded."],"exampleFix":"// before (client) — X-TIMESTAMP is a date string\nconn.setRequestProperty(\"X-TIMESTAMP\", \"2024-01-01 12:00:00\");\n\n// after — X-TIMESTAMP is a valid numeric value\nconn.setRequestProperty(\"X-TIMESTAMP\", String.valueOf(System.currentTimeMillis()));","handlingStrategy":"try-catch","validationCode":"// Client-side: validate timestamp format before sending\nString xTimestamp = String.valueOf(System.currentTimeMillis());\ntry {\n    Long.parseLong(xTimestamp); // verify it's a valid number\n} catch (NumberFormatException e) {\n    throw new IllegalStateException(\"Invalid timestamp format\");\n}","typeGuard":"public static boolean isValidTimestampFormat(String xTimestamp) {\n    if (xTimestamp == null || xTimestamp.isEmpty()) return false;\n    try {\n        Long.parseLong(xTimestamp);\n        return xTimestamp.length() == 14 || xTimestamp.length() == 13;\n    } catch (NumberFormatException e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    response = httpClient.execute(request);\n} catch (IllegalArgumentException e) {\n    String msg = e.getMessage();\n    if (msg.startsWith(\"Sign签名校验失败：\")) {\n        // Extract the underlying cause from the message suffix\n        String cause = msg.substring(msg.indexOf('：') + 1);\n        log.error(\"Signature validation infrastructure error: {}\", cause);\n    }\n    throw e;\n}","preventionTips":["Always send X-TIMESTAMP as a valid numeric string","Ensure the request body InputStream is not consumed before the sign interceptor reads it","Check that BodyReaderHttpServletRequestWrapper is registered in the filter chain","Validate all required beans (JeecgBaseConfig) are initialized before processing signed requests"],"tags":["signature","security","configuration","request-body"],"backgroundTag":null,"analyzedSha":"96fb33f5ec68516da0b0147da06b2eb0419e063a","analyzedAt":"2026-08-14T00:04:16.786Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}