Skip to content

Commit

Permalink
Improve input error display when fuzzing a single value
Browse files Browse the repository at this point in the history
  • Loading branch information
rtpt-erikgeiser committed Jun 21, 2023
1 parent f1c0fe6 commit 85bbc02
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion reporter/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ next_response:
var reqErr response.InvalidRequest
if errors.As(resp.Error, &reqErr) {
errString := cleanedErrorString(reqErr.Err)
stats.InvalidInputData[errString] = append(stats.InvalidInputData[errString], fmt.Sprintf("%q", resp.Values))
stats.InvalidInputData[errString] = append(stats.InvalidInputData[errString], formatValues(resp.Values))

continue
}
Expand Down Expand Up @@ -190,6 +190,14 @@ next_response:
return nil
}

func formatValues(values []string) string {
if len(values) == 1 {
return fmt.Sprintf("%q", values[0])
}

return fmt.Sprintf("%q", values)
}

func sortedKeys(m map[string][]string) []string {
keys := make([]string, 0, len(m))

Expand Down

0 comments on commit 85bbc02

Please sign in to comment.