Greg Mann created MESOS-7629:
--------------------------------
Summary: Parsing to protobuf leads to API call validation errors
Key: MESOS-7629
URL: https://issues.apache.org/jira/browse/MESOS-7629
Project: Mesos
Issue Type: Bug
Components: stout
Reporter: Greg Mann
The {{::protobuf::parse()}} function will [silently drop unrecognized
fields|https://github.com/apache/mesos/blob/7ec3269d51d7d180aa857140097c170c469d7959/3rdparty/stout/include/stout/protobuf.hpp#L589],
which makes sense in the context of maintaining backward-compatibility across
different Mesos versions which may add or remove fields from protobuf messages.
However, since we [rely on this protobuf
parsing|https://github.com/apache/mesos/blob/7ec3269d51d7d180aa857140097c170c469d7959/src/master/http.cpp#L514-L520]
in some places for validation of user-supplied JSON, this can lead to API
endpoints returning successful 2XX responses, when in fact the JSON was
malformed and the call has not been completed as submitted.
We should consider adding a parameter to API calls which allows users to
enable/disable ignoring unrecognized fields in the call. If the default
behavior for JSON requests was to return an error rather than ignore
unrecognized fields, then our parsing code would catch malformed JSON
submissions. The user could opt-in to the "ignore unrecognized fields" behavior
when backwards compatibility is a concern.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)