News for hackers. Stuff that matters.
Re:Application Load Balancers enables gRPC workloads with en... by jeffbee on Friday October 30, 2020 @04:11PM (#24946407)

  % echo '{"a": 5, "a": 42}' | jq  
  {
    "a": 42
  }
Pretty much what I expected and also what you would get if you saw two instances of the same optional non-repeated field in a protocol buffer message. What were you expecting or wanting?
Re:Application Load Balancers enables gRPC workloads with en... by q3k on Friday October 30, 2020 @04:29PM (#24946578)
Here's the kicker: while this might sensible to you, some JSON implementations out there will reject duplicate fields (fail a parse completely), and the RFC does not even specify what is the correct behavior (override previous, ignore duplicates, fail entire parse, return non-unique keyed dictionary, something else entirely?).

So while to you and I this behavior might be expected (although I'm still not sure that overriding previous fields is more obvious than ignoring repeated fields) - some library implements thought differently, and there isn't even an agreed on standard. Arguing about this isn't purely academic, either - there have been security vulnerabilities resulting from these differences [1].

[1] - https://justi.cz/security/2017/11/14/couchdb-rce-npm.html

Re:Application Load Balancers enables gRPC workloads with en... by jeffbee on Friday October 30, 2020 @04:54PM (#24946799)
Interesting. Protobuf specifies this last-instance-wins behavior, and it can be pretty useful. It allows you to override a field by simply appending a few bytes, without having to re-encode a whole message. JSON I guess doesn't have as much concern for efficiency as protobuf has.
Re:Application Load Balancers enables gRPC workloads with en... by Groxx on Friday October 30, 2020 @04:25PM (#24946536)
Their point was likely that implementations vary on the interpretation. Which is a bit of a problem for rpc systems.