Compare commits

...

2 Commits

Author SHA1 Message Date
eball
4092339b5d fix: improve timestamp validation logic in CheckJWS function 2025-12-15 20:54:38 +08:00
eball
7af836d1e9 cli: refactor timestamp check for clarity and correctness 2025-12-15 20:36:11 +08:00

View File

@@ -192,7 +192,8 @@ func CheckJWS(jws string, duration int64) (*CheckJWSResult, error) {
// Check timestamp
now := time.Now().UnixMilli()
if now-timestamp > duration {
diff := now - timestamp
if max(diff, -diff) > duration {
return nil, fmt.Errorf("timestamp is out of range")
}