{"record":{"id":"d60f283a2c9f632c","repo":"jeecgboot/JeecgBoot","slug":"timastamp-d60f28","errorCode":null,"errorMessage":"timastamp时间戳不合法","messagePattern":"timastamp时间戳不合法","errorType":"exception","errorClass":"JeecgBootException","httpStatus":null,"severity":"error","filePath":"jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/openapi/filter/ApiAuthFilter.java","lineNumber":205,"sourceCode":"    /**\n     * 签名验证\n     * @param appkey\n     * @param signature\n     * @param timestamp\n     * @return\n     */\n    protected void checkSignValid(String appkey, String signature, String timestamp) {\n        if (!StringUtils.hasText(appkey)) {\n            throw new JeecgBootException(\"appkey为空\");\n        }\n        if (!StringUtils.hasText(signature)) {\n            throw new JeecgBootException(\"signature为空\");\n        }\n        if (!StringUtils.hasText(timestamp)) {\n            throw new JeecgBootException(\"timastamp时间戳为空\");\n        }\n        if (!timestamp.matches(\"[0-9]*\")) {\n            throw new JeecgBootException(\"timastamp时间戳不合法\");\n        }\n        if (System.currentTimeMillis() - Long.parseLong(timestamp) > 5 * 60 * 1000) {\n            throw new JeecgBootException(\"signature签名已过期(超过五分钟)\");\n        }\n    }\n\n    /**\n     * 认证信息核验\n     * @param appKey\n     * @param signature\n     * @param timestamp\n     * @param openApiAuth\n     * @return\n     * @throws Exception\n     */\n    protected void checkSignature(String appKey, String signature, String timestamp, OpenApiAuth openApiAuth) {\n        if(openApiAuth==null){\n            throw new JeecgBootException(\"不存在认证信息\");","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/jeecgboot/JeecgBoot/blob/96fb33f5ec68516da0b0147da06b2eb0419e063a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/openapi/filter/ApiAuthFilter.java#L187-L223","documentation":"Thrown by checkSignValid when the timestamp fails the regex '[0-9]*' (i.e. contains non-digit characters, or is empty after the hasText check). The matcher accepts any all-digit string, so this rejects values like '1700000000000ms', '1.7e12', or negative signs. The regex also matches empty string, but the earlier hasText guard prevents that case.","triggerScenarios":"Client sends timestamp as seconds vs milliseconds with units attached, as a float, or with timezone text; a JSON payload that stringifies a number with formatting.","commonSituations":"Client library formats Date as ISO-8601 or with 'Z' suffix; mixing second-precision and millisecond-precision conventions; localization that inserts separators.","solutions":["Send timestamp as a pure-digit epoch-millis string, e.g. String.valueOf(System.currentTimeMillis()).","If the client uses seconds, multiply by 1000 and stringify.","Strip any non-digit characters before sending."],"exampleFix":"// before: timestamp = \"2026-08-13T10:00:00Z\"\n// after:  timestamp = String.valueOf(System.currentTimeMillis());  // e.g. \"1755079200000\"","handlingStrategy":"validation","validationCode":"// Reject any timestamp that is not pure digits\nif (timestamp == null || !timestamp.matches(\"\\\\d+\")) {\n    throw new IllegalArgumentException(\"timestamp must be all-digit epoch millis\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Send epoch-millis as a string of digits only.","Do not use ISO-8601 or float notation for this field.","Centralize timestamp formatting in the client SDK."],"tags":["openapi","auth","signature","timestamp","input-validation"],"backgroundTag":null,"analyzedSha":"96fb33f5ec68516da0b0147da06b2eb0419e063a","analyzedAt":"2026-08-14T00:04:16.786Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}