Repository navigation
fix(types): reject non-string Any JSON fallback payloads - #498
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
recheck |
|
@iainmcgin Could you review this fix for #487? It rejects non-string Any JSON fallback payloads and adds regression coverage for both registry states. Local lint and workspace tests passed. |
An Any whose type has no JSON entry in the type registry parsed to an empty payload when its JSON used the expanded form, because that path read only the "value" key. Every key other than "@type" and "value" is now an error there. The three errors on that path (an extra key, a non-string "value", a string that is not base64) say whether a registry is installed, name the type URL, and name how to register the message. The guide documents both JSON forms of Any and the registration that the expanded form needs.
|
[claude code] Thanks for the fix. I pushed a merge of The fallback read only the One consequence: an unregistered entry in expanded form, in
|
iainmcgin
left a comment
There was a problem hiding this comment.
[claude code] Approved on behalf of @iainmcgin after review; CI is 11/11 green on 1bb2c25.
Unregistered
Anytype URLs currently accept object, array, number, and booleanvaluepayloads and silently replace them with empty bytes. Return a descriptive deserialization error for these malformed inputs so payload data cannot disappear unnoticed.Missing,
null, and empty-string payloads retain their existing empty-byte behavior. Valid base64 strings and registered-type decoding are unchanged. Regression tests cover both a missing registry and an installed registry without the requested type, including valid and invalid base64 controls.Fixes #487.
Validation:
task linttask test(with repository-pinned protoc 33.5)cargo test -p buffa-types --features json fallback_base64