Harden PromptKit upgrade integration
This commit is contained in:
@@ -519,8 +519,15 @@ func validateSafeErrorJSON(decoder *json.Decoder) error {
|
||||
}
|
||||
|
||||
func validateRepairAttemptsJSON(decoder *json.Decoder) error {
|
||||
var raw json.RawMessage
|
||||
if err := decoder.Decode(&raw); err != nil {
|
||||
return err
|
||||
}
|
||||
if bytes.Equal(bytes.TrimSpace(raw), []byte("null")) {
|
||||
return fmt.Errorf("repairAttempts must be an integer")
|
||||
}
|
||||
var value int
|
||||
if err := decoder.Decode(&value); err != nil {
|
||||
if err := json.Unmarshal(raw, &value); err != nil {
|
||||
return err
|
||||
}
|
||||
if value < 0 {
|
||||
|
||||
Reference in New Issue
Block a user