Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
0.10.0
-
None
-
macOs: 10.11.6
Thrift: 0.10.0
Python: 3.6
Node.js: 8.0.0
-
Patch, Important
Description
Python and Node.js client and server generated code doesn't make a validation on the type of Struct passed as argument of a Service.
Example:
// First Struct struct StructA { 1: required string query, 2: required i32 max_results } // Second Struct struct StructB { 1: required string query } // Service with a method that has the second Struct as argument service Question { string make_question(1: StructB); }
After generating the python and Node.js code from this thrift file, the behaviour occurs when the client calls the server method passing a different Struct type to it (example with python client):
res = client.make_question(StructA(query="hello", max_results=5))
This code doesn't throw any kind of error, because the type of the Struct is not validated and the two Structs from the example have the same argument 'query'.
Neither the server side throws an exception, interpreting the upcoming client message as StructB, even if its type is StructA.
Is it possible that this kind of check is not made in any of the non-typed languages supported by thrift?