Repository navigation
fix(fund): reject an invalid filter JSON in the C and Java bindings - #635
Open
hogan-yuan wants to merge 2 commits into
Open
hogan-yuan wants to merge 2 commits into
hogan-yuan wants to merge 2 commits into
Conversation
lb_fund_context_funds and the Java FundContext.funds binding parsed the filter with if-let Ok(..) and silently dropped it on a parse error, so the request went out unfiltered and returned the whole fund catalogue. Propagate the parse error instead (C: JSON decode error via the callback; Java: RuntimeException), matching Node.js and Python.
Match the message Java, Node.js and Python already use, document the behaviour on the C++ GetFundsOptions::filter and that Java throws synchronously from funds(), and unit-test build_get_funds_options with invalid, valid and absent filters.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FundContext.fundstakes the server-defined filter as a JSON string. The C (lb_fund_context_funds) and Java bindings parsed it withif let Ok(..)and dropped it on a parse error, so the request went out unfiltered and the caller got the whole fund catalogue back as if the filter had applied — no error anywhere. Node.js and Python already reject it (invalid filter JSON: …).What changes
RuntimeException("invalid filter JSON: …"), the same wayHttpClient.requestreports an unparsable body.lb_get_funds_options_t.filterandGetFundsOptions.setFiltersay so;longbridge.hregenerated.A null / unset filter is unchanged.
🤖 Generated with Claude Code