Skip to content

Commit 3480cc5

Browse files
GRPC: Make ra.FinalizeOrder a pass-through (letsencrypt#5549)
- Move `FinalizeOrder` logic from `grpc/ra-wrappers.go` to `ra` and `wfe` Fixes letsencrypt#5530
1 parent 2a5b9f6 commit 3480cc5

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

grpc/ra-wrappers.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,7 @@ func (ras *RegistrationAuthorityClientWrapper) NewOrder(ctx context.Context, req
7575
}
7676

7777
func (ras *RegistrationAuthorityClientWrapper) FinalizeOrder(ctx context.Context, request *rapb.FinalizeOrderRequest) (*corepb.Order, error) {
78-
resp, err := ras.inner.FinalizeOrder(ctx, request)
79-
if err != nil {
80-
return nil, err
81-
}
82-
if resp == nil || !orderValid(resp) {
83-
return nil, errIncompleteResponse
84-
}
85-
return resp, nil
78+
return ras.inner.FinalizeOrder(ctx, request)
8679
}
8780

8881
// RegistrationAuthorityServerWrapper is the gRPC version of a core.RegistrationAuthority server
@@ -147,9 +140,5 @@ func (ras *RegistrationAuthorityServerWrapper) NewOrder(ctx context.Context, req
147140
}
148141

149142
func (ras *RegistrationAuthorityServerWrapper) FinalizeOrder(ctx context.Context, request *rapb.FinalizeOrderRequest) (*corepb.Order, error) {
150-
if request == nil || request.Order == nil || request.Csr == nil {
151-
return nil, errIncompleteRequest
152-
}
153-
154143
return ras.inner.FinalizeOrder(ctx, request)
155144
}

ra/ra.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,10 @@ func (ra *RegistrationAuthorityImpl) failOrder(
980980
// If successful the order will be returned in processing status for the client
981981
// to poll while awaiting finalization to occur.
982982
func (ra *RegistrationAuthorityImpl) FinalizeOrder(ctx context.Context, req *rapb.FinalizeOrderRequest) (*corepb.Order, error) {
983+
if req == nil || req.Order == nil {
984+
return nil, errIncompleteGRPCRequest
985+
}
986+
983987
order := req.Order
984988

985989
if order.Status != string(core.StatusReady) {

wfe2/wfe.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2275,6 +2275,11 @@ func (wfe *WebFrontEndImpl) FinalizeOrder(ctx context.Context, logEvent *web.Req
22752275
wfe.sendError(response, logEvent, web.ProblemDetailsForError(err, "Error finalizing order"), err)
22762276
return
22772277
}
2278+
if updatedOrder == nil || order.Id == 0 || order.Created == 0 || order.RegistrationID == 0 || order.Expires == 0 || len(order.Names) == 0 {
2279+
err = errors.New("Incomplete gRPC response message")
2280+
wfe.sendError(response, logEvent, web.ProblemDetailsForError(err, "Error validating order"), err)
2281+
return
2282+
}
22782283

22792284
orderURL := web.RelativeEndpoint(request,
22802285
fmt.Sprintf("%s%d/%d", orderPath, acct.ID, updatedOrder.Id))

0 commit comments

Comments
 (0)