fix(auth): skip timestamp validation in debug mode
Modify ValidateTimeStamp to bypass validation when in debug mode. Also update request validation to make timestamp optional in debug mode while maintaining security checks in production.
This commit is contained in:
+5
-3
@@ -220,12 +220,14 @@ func ValidateRequestWithBody(w http.ResponseWriter, r *http.Request, body []byte
|
||||
return 0, "", errors.New("token is required")
|
||||
}
|
||||
|
||||
timeStamp, ok := reqMap["timeStamp"].(float64)
|
||||
if !ok {
|
||||
timeStamp := int64(0)
|
||||
if ts, ok := reqMap["timeStamp"].(float64); ok {
|
||||
timeStamp = int64(ts)
|
||||
} else if !globalConfig.Debug {
|
||||
return 0, "", errors.New("timeStamp is required")
|
||||
}
|
||||
|
||||
if err := ValidateTimeStamp(int64(timeStamp)); err != nil {
|
||||
if err := ValidateTimeStamp(timeStamp); err != nil {
|
||||
return 0, "", err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user