-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jsonpb panics when using numbers for parsing timestamps #1025
Comments
Hi, thanks for the brilliant bug report 😍. This is a good find, but I think the bug here is in https://play.golang.org/p/2VS9bEb7sgD The issue only seems to happen when using a pointer to the type before unmarshalling, as can be seen in this working example: https://play.golang.org/p/kIAksR51kaz I've raised an issue with https://github.com/golang/protobuf, we'll see if they think we're using it incorrectly, or if they are going to fix it. I would argue the unmarshaller shouldn't crash here, so I suspect it is a real bug. Unfortunately, until that is resolved, I don't think there's much we can do here. I would consider this to be a DOS vulnerability in any servers using A possible workaround is to use a string here and manually parse it in your gRPC server. |
Another option is to fork |
Thanks @johanbrandhorst for looking into it and forwarding it to the relevant repository :-) |
Looks like this has been kicked back to us, and I'm pretty sure what the fix should be. We can change the Would you be interested in bringing this fix in? |
You snooze you lose 😁. I put together a fix in #1028. |
* runtime: stop using nil ponters with Unmarshal Fixes #1025
* runtime: stop using nil ponters with Unmarshal Fixes grpc-ecosystem#1025
Steps you follow to reproduce the error:
Result: panic on server side, empty http response
Example repository:
https://github.com/djavorszky/grpc-timestamp-bugtest
Steps here:
go run main.go
)curl localhost:8080/v1/1/123
Notes: The implementation is not tied in, but as I can see the issue occurs before reaching the implementation, so that shouldn't be any issue. This has been tested and reproduced with a much more complicated service where the implementation works as intended
What did you expect to happen instead:
What's your theory on why it isn't working:
Looking at the stacktrace and the underlying code, looks like reflection is used to try to parse the GET parameter as a Timestamp without making any assertions to see if it can be casted.
Either that, or not handling the failure gracefully.
Tested with gprc-gateway versions 1.8.3 and 1.10.0
The text was updated successfully, but these errors were encountered: