-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix case sensitive query parameters #8852
Fix case sensitive query parameters #8852
Conversation
…rameter values. Introduce small framework to extend to other query parameter keys as required. Signed-off-by: Jeff Schmidt <jeffrey.schmidt@swirldslabs.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8852 +/- ##
=========================================
Coverage 92.19% 92.19%
- Complexity 7597 7598 +1
=========================================
Files 925 925
Lines 30407 30427 +20
Branches 3694 3706 +12
=========================================
+ Hits 28033 28053 +20
Misses 1548 1548
Partials 826 826 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Xin Li <xin@swirldslabs.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Quality Gate passedIssues Measures |
Some rest api endpoints return 500 with `order=ASC` / `order=DESC`, examples: - `https://mainnet-public.mirrornode.hedera.com/api/v1/contracts/results/logs?order=ASC` - `https://mainnet-public.mirrornode.hedera.com/api/v1/accounts/0.0.1274288/nfts?limit=100&order=ASC` The transactions REST API misinterprets query filter `result=SUCCESS` to look for transactions with response code not equal to 22. The issue is only all lower case `success` is interpreted as response code equal to 22. On top of the inverted interpretation, this may also cause query timeout, e.g., when combined with `account.id` for which there's very few failed transactions. This PR, in the `requestHander.js` middleware Express query parser, ensures the query parameter values to selected parameters (currently just `order` and `result`) are forced to lowercase before the request is routed to the request handler code. --------- Signed-off-by: Jeff Schmidt <jeffrey.schmidt@swirldslabs.com> Signed-off-by: Xin Li <xin@swirldslabs.com> Co-authored-by: Xin Li <xin@swirldslabs.com>
Description:
Some rest api endpoints return 500 with
order=ASC
/order=DESC
, examples:https://mainnet-public.mirrornode.hedera.com/api/v1/contracts/results/logs?order=ASC
https://mainnet-public.mirrornode.hedera.com/api/v1/accounts/0.0.1274288/nfts?limit=100&order=ASC
The transactions REST API misinterprets query filter
result=SUCCESS
to look for transactions with response code not equal to 22. The issue is only all lower casesuccess
is interpreted as response code equal to 22. On top of the inverted interpretation, this may also cause query timeout, e.g., when combined withaccount.id
for which there's very few failed transactions.This PR, in the
requestHander.js
middleware Express query parser, ensures the query parameter values to selected parameters (currently justorder
andresult
) are forced to lowercase before the request is routed to the request handler code.Related issue(s):
Fixes #8790
Fixes #8801
Notes for reviewer:
Checklist