Repository navigation
feat(api): reject unpaired surrogates in protobuf string fields - #7102
halibobo1205 wants to merge 1 commit into
Conversation
waynercheung
left a comment
There was a problem hiding this comment.
Reviewed commit 0f604c6.
No blocking correctness findings. Validation runs after unescaping and before protobuf string fields are assigned, with separate checks for the HTTP and JSON-RPC deployment-name setters. Valid Unicode and existing bytes conversions are unchanged.
packTransaction still drops contracts whose parameters fail to parse, which matches the compatibility note in the PR description.
[QUESTION] Should rejecting unpaired surrogates in visible=true text inputs to name-string bytes fields, such as account_name, be considered separately? This PR explicitly preserves the existing conversions.
Approved from the code-review perspective. One non-blocking regression-test suggestion is included inline.
| } | ||
|
|
||
| @Test | ||
| public void testStringFieldRejectsUnpairedSurrogates() { |
There was a problem hiding this comment.
[NIT] Please add a regression test for Util.packTransaction with an unpaired surrogate in a contract parameter, asserting the documented dropped-contract behavior. A Permission.permission_name case is optional, since it uses the same STRING path already covered here.
Yes, intentional. This PR covers values bound to protobuf I kept it out because it is a |
|
[SUGGESTION, non-blocking] Consider a follow-up to reject unpaired surrogates at the remaining text conversion boundaries:
I reproduced Validation should run on the original Java string before encoding or hashing. Checking This can remain a follow-up since this PR explicitly preserves existing |
What does this PR do?
Validates HTTP and JSON-RPC values assigned to protobuf
stringfields, rejecting unpaired surrogates. This aligns validation with the UTF-8 requirement enforced during gRPC/protobuf decoding.Why are these changes required?
Malformed Unicode is currently accepted and replaced with
?during protobuf serialization. This change validates it explicitly during request handling.Compatibility changes:
stringvalues now cause parsing or parameter errors instead of replacement.bytesfield conversions remain unchanged.This PR has been tested by:
Follow up
None.
Extra details
Only HTTP and JSON-RPC request handling changes. Transaction validation, transaction execution and block processing are unchanged.