kpumuk opened a new pull request, #3744:
URL: https://github.com/apache/thrift/pull/3744
<!-- Explain the changes in the pull request below: -->
Ruby's `JsonProtocol` lets `ArgumentError` escape when a JSON binary value
contains an invalid Base64 alphabet or invalid padding. This bypasses the
normal Thrift protocol-error path and can cause malformed method arguments to
be classified as a generic application failure.
This change translates only strict Base64 decoding failures into
`ProtocolException::INVALID_DATA`. Valid Base64 values, including the existing
optional-padding behavior, continue to decode unchanged.
## Benchmarks
A temporary focused harness decoded 20,000 valid JSON binary values per
trial through `JsonProtocol`. Both revisions used Ruby 4.0.6 in the same
worktree container, with 3 warmup runs and 11 measured trials.
Command: `docker exec --workdir /thrift/src/lib/rb thrift-3422 bundle exec
ruby -Ilib /thrift/src/.rb044-benchmark.rb`
| Revision | Median | Throughput |
| --- | ---: | ---: |
| `upstream/master` (`04c87e89a`) | 0.201569 s | 99,222 values/s |
| Proposed change | 0.202746 s | 98,646 values/s |
The proposed median was 0.6% slower and throughput was 0.6% lower. This
in-memory workload isolates successful Base64 decoding and therefore amplifies
the cost of the added exception boundary; it does not include transport,
processor, or application work. No material valid-input regression was observed.
<!-- We recommend you review the checklist/tips before submitting a pull
request. -->
- [x] Did you create an [Apache
Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket?
[THRIFT-6156](https://issues.apache.org/jira/browse/THRIFT-6156)
- [x] If a ticket exists: Does your pull request title follow the pattern
"THRIFT-NNNN: describe my issue"?
- [x] Did you squash your changes to a single commit? (not required, but
preferred)
- [x] Did you do your best to avoid breaking changes? If one was needed,
did you label the Jira ticket with "Breaking-Change"?
- [ ] If your change does not involve any code, include `[skip ci]` anywhere
in the commit message to free up build resources.
<!--
The Contributing Guide at:
https://github.com/apache/thrift/blob/master/CONTRIBUTING.md
has more details and tips for committing properly.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]