Closed albanbruder closed 1 year ago
Hello @fritterhoff,
Thanks for the great work on this project.
I have discovered a bug related to the parsing of dates returned by the Sectigo API. The API may return a null date in the ListByPersonEmail response if the certificate was rejected. In this case the parsing of the JSONDate will fail.
Request: https://cert-manager.com/api/smime/v2/byPersonEmail/user@example.com Response:
{ "id": <redacted>, "state": "rejected", "certificateDetails": {}, "serialNumber": "", "orderNumber": 0, "backendCertId": null, "expires": null }
Location: https://github.com/hm-edu/sectigo-client/blob/main/sectigo/misc/date.go#L17
Error log:
{ "level":"error", "ts":"2023-08-09T08:12:13.051Z", "caller":"zap/options.go:212", "msg":"finished unary call with code Internal", "grpc.start_time":"2023-08-09T08:12:12Z", "system":"grpc", "span.kind":"server", "grpc.service":"pkiService.SmimeService", "grpc.method":"ListCertificates", "error":"rpc error: code = Internal desc = parsing time \"null\" as \"2006-01-02\": cannot parse \"null\" as \"2006\"", "grpc.code":"Internal", "grpc.time_ms":830.216, "stacktrace":"github.com/grpc-ecosystem/go-grpc-middleware/logging/zap.DefaultMessageProducer\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.4.0/logging/zap/options.go:212\ngithub.com/grpc-ecosystem/go-grpc-middleware/logging/zap.UnaryServerInterceptor.func1\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.4.0/logging/zap/server_interceptors.go:39\ngithub.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func2.1\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.4.0/chain.go:48\ngo.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc.UnaryServerInterceptor.func1\n\t/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc@v0.42.0/interceptor.go:344\ngithub.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func2.1\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.4.0/chain.go:48\ngithub.com/grpc-ecosystem/go-grpc-middleware/recovery.UnaryServerInterceptor.func1\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.4.0/recovery/interceptors.go:33\ngithub.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func2\n\t/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.4.0/chain.go:53\ngithub.com/hm-edu/portal-apis._SmimeService_ListCertificates_Handler\n\t/go/pkg/mod/github.com/hm-edu/portal-apis@v0.0.0-20230731060801-90ca7bb8cec2/pki_grpc.pb.go:324\ngoogle.golang.org/grpc.(*Server).processUnaryRPC\n\t/go/pkg/mod/google.golang.org/grpc@v1.57.0/server.go:1360\ngoogle.golang.org/grpc.(*Server).handleStream\n\t/go/pkg/mod/google.golang.org/grpc@v1.57.0/server.go:1737\ngoogle.golang.org/grpc.(*Server).serveStreams.func1.1\n\t/go/pkg/mod/google.golang.org/grpc@v1.57.0/server.go:982" }
Hi @albanbruder,
thanks for the report. Actually I never stumbled over this situation 🙄
I'll try to fix it as soon as possible 😉
Hello @fritterhoff,
Thanks for the great work on this project.
I have discovered a bug related to the parsing of dates returned by the Sectigo API. The API may return a null date in the ListByPersonEmail response if the certificate was rejected. In this case the parsing of the JSONDate will fail.
Request: https://cert-manager.com/api/smime/v2/byPersonEmail/user@example.com Response:
Location: https://github.com/hm-edu/sectigo-client/blob/main/sectigo/misc/date.go#L17
Error log: