Skip to content

Commit

Permalink
Add error message when computing consistency proof (#2278)
Browse files Browse the repository at this point in the history
The service would panic if firstSize > lastSize because the error
object was not created.

Signed-off-by: Hayden Blauzvern <[email protected]>
  • Loading branch information
haydentherapper authored Nov 19, 2024
1 parent 3eb84f9 commit 56ea4b5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/api/tlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ func stringPointer(s string) *string {
// GetLogProofHandler returns information required to compute a consistency proof between two snapshots of log
func GetLogProofHandler(params tlog.GetLogProofParams) middleware.Responder {
if *params.FirstSize > params.LastSize {
return handleRekorAPIError(params, http.StatusBadRequest, nil, fmt.Sprintf(firstSizeLessThanLastSize, *params.FirstSize, params.LastSize))
errMsg := fmt.Sprintf(firstSizeLessThanLastSize, *params.FirstSize, params.LastSize)
return handleRekorAPIError(params, http.StatusBadRequest, fmt.Errorf("consistency proof: %s", errMsg), errMsg)
}
tc := trillianclient.NewTrillianClient(params.HTTPRequest.Context(), api.logClient, api.logID)
if treeID := swag.StringValue(params.TreeID); treeID != "" {
Expand Down

0 comments on commit 56ea4b5

Please sign in to comment.