beltram 3 лет назад
Родитель
Сommit
9d5c974f44
2 измененных файлов с 10 добавлено и 2 удалено
  1. 8 0
      acme/challenge.go
  2. 2 2
      acme/db/nosql/wire.go

+ 8 - 0
acme/challenge.go

@@ -446,6 +446,10 @@ func wireOIDC01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose.JSO
 		return WrapErrorISE(err, "Could not find current order by account id")
 	}
 
+	if len(orders) != 1 {
+		return WrapErrorISE(err, "There are too many orders for this account for this custom OIDC challenge")
+	}
+
 	if err := db.CreateOidcToken(ctx, orders[0], oidcToken); err != nil {
 		return WrapErrorISE(err, "Failed storing OIDC id token")
 	}
@@ -587,6 +591,10 @@ func wireDPOP01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose.JSO
 		return WrapErrorISE(err, "Could not find current order by account id")
 	}
 
+	if len(orders) != 1 {
+		return WrapErrorISE(err, "There are too many orders for this account for this custom DPoP challenge")
+	}
+
 	if err := db.CreateDpopToken(ctx, orders[0], dpop); err != nil {
 		return WrapErrorISE(err, "Failed storing DPoP token")
 	}

+ 2 - 2
acme/db/nosql/wire.go

@@ -26,7 +26,7 @@ func (db *DB) getDBDpopToken(ctx context.Context, orderId string) (*dbDpopToken,
 	}
 
 	d := new(dbDpopToken)
-	if err := json.Unmarshal(b, &d); err != nil {
+	if err := json.Unmarshal(b, d); err != nil {
 		return nil, errors.Wrapf(err, "error unmarshaling dpop %s into dbDpopToken", orderId)
 	}
 	return d, nil
@@ -79,7 +79,7 @@ func (db *DB) getDBOidcToken(ctx context.Context, orderId string) (*dbOidcToken,
 		return nil, errors.Wrapf(err, "error loading oidc token %s", orderId)
 	}
 	o := new(dbOidcToken)
-	if err := json.Unmarshal(b, &o); err != nil {
+	if err := json.Unmarshal(b, o); err != nil {
 		return nil, errors.Wrapf(err, "error unmarshaling oidc token %s into dbOidcToken", orderId)
 	}
 	return o, nil