{"record":{"id":"0433afaf5bacfd6d","repo":"AlistGo/alist","slug":"expire-invalid","errorCode":null,"errorMessage":"expire invalid","messagePattern":"expire invalid","errorType":"http","errorClass":"ErrExpireInvalid","httpStatus":401,"severity":"error","filePath":"pkg/sign/sign.go","lineNumber":13,"sourceCode":"package sign\n\nimport \"errors\"\n\ntype Sign interface {\n\tSign(data string, expire int64) string\n\tVerify(data, sign string) error\n}\n\nvar (\n\tErrSignExpired   = errors.New(\"sign expired\")\n\tErrSignInvalid   = errors.New(\"sign invalid\")\n\tErrExpireInvalid = errors.New(\"expire invalid\")\n\tErrExpireMissing = errors.New(\"expire missing\")\n)\n","sourceCodeStart":1,"sourceCodeEnd":16,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/pkg/sign/sign.go#L1-L16","documentation":"ErrExpireInvalid from HMACSign.Verify: the trailing segment of the sign string (after the last ':') was parsed with strconv.ParseInt and failed, so the signature cannot carry a valid expiry timestamp.","triggerScenarios":"Verify receives a sign whose last ':'-separated segment is not a decimal Unix timestamp — e.g. \"abc\" instead of \"1700000000\", or an empty-but-present segment that still fails parsing.","commonSituations":"Sign strings produced by a different implementation, hand-crafted signatures, or the sign being split/rejoined incorrectly when passing through query parameters.","solutions":["Only pass sign strings produced by HMACSign.Sign, which appends \":<unix-seconds>\"","If generating signs externally, format the expiry as base10 Unix seconds in the final segment","URL-encode the sign value when transporting it in a query so separators survive"],"exampleFix":"// before\nsign := \"c2lnbmF0dXJlOmFiYw==\" // no numeric expiry segment\n\n// after\nsign := hmacSign.NewHMACSign(secret).Sign(data, time.Now().Add(time.Hour).Unix())\n// -> \"<base64url-hmac>:1700000000\"","handlingStrategy":"validation","validationCode":"parts := strings.Split(signStr, \":\")\nif _, err := strconv.ParseInt(parts[len(parts)-1], 10, 64); err != nil {\n\treturn errors.New(\"sign string lacks a numeric expiry segment\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use sign strings produced by HMACSign.Sign","URL-encode signs transported via query parameters"],"tags":["signing","parsing","validation"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}