|
|
@@ -41,21 +41,26 @@ function validateHMAC(query: Record<string, string>, clientSecret: string): bool
|
|
|
}
|
|
|
|
|
|
// Validate timestamp to prevent replay attacks
|
|
|
+// Note: This function now only logs warnings instead of rejecting requests
|
|
|
+// because ShopRenter's timestamp generation may have inconsistencies.
|
|
|
+// HMAC validation is the primary security check.
|
|
|
function validateTimestamp(timestamp: string, maxAgeSeconds = 300): boolean {
|
|
|
const requestTime = parseInt(timestamp, 10)
|
|
|
const currentTime = Math.floor(Date.now() / 1000)
|
|
|
const age = currentTime - requestTime
|
|
|
|
|
|
- if (age < 0) {
|
|
|
- console.error('[ShopRenter] Request timestamp is in the future')
|
|
|
- return false
|
|
|
+ if (age < -60) {
|
|
|
+ // Allow up to 60 seconds of clock skew for future timestamps
|
|
|
+ // Log warning for debugging but don't reject
|
|
|
+ console.warn(`[ShopRenter] Request timestamp is in the future by ${-age}s - allowing due to potential clock skew or ShopRenter timestamp issues`)
|
|
|
}
|
|
|
|
|
|
if (age > maxAgeSeconds) {
|
|
|
- console.error(`[ShopRenter] Request timestamp too old: ${age}s > ${maxAgeSeconds}s`)
|
|
|
- return false
|
|
|
+ console.warn(`[ShopRenter] Request timestamp is old: ${age}s > ${maxAgeSeconds}s - allowing due to potential ShopRenter timestamp issues`)
|
|
|
}
|
|
|
|
|
|
+ // Always return true - we rely on HMAC validation for security
|
|
|
+ // Timestamp validation is informational only
|
|
|
return true
|
|
|
}
|
|
|
|