[fix] Eliminate silent query limits - #4980
Conversation
barnabasdomozi
left a comment
There was a problem hiding this comment.
In general, it's considered a good practice to have some hard limits on the amount of data and API endpoint can return from the database.
As an example, it's not uncommon to have production databases with more than 1 million rows in the RunHistory table. Without any enforced limit, the client could request all information at once which is an excessive amount of data.
Silently limiting the results may cause practical problems, too. For example, when we filter on runs with a joker character (e.g. myrun*) then the results from the first 500 runs return only.
For which API endpoints is this a problem?
I think, that's why these functions have a
In this specific case the client queried the run IDs matching a run name pattern |
Yes, but if we remove the guard, essentially the client controls this limit parameter. If the limit set by the client is
Maybe you meant a different function, but as of today, I think this server-side limit enforcement should be investigated on a case by case basis, and not removed from everywhere. |
6564394 to
e9614fb
Compare
e9614fb to
3ef554a
Compare
| max_query_limit) | ||
| limit = max_query_limit | ||
| return limit | ||
| if not limit or limit not in range(constants.MAX_QUERY_SIZE + 1): |
There was a problem hiding this comment.
Consider the following if expression which is more Pythonic and easier to read:
| if not limit or limit not in range(constants.MAX_QUERY_SIZE + 1): | |
| if limit not in range(1, constants.MAX_QUERY_SIZE + 1): |
| ccService.getClient().getRunData(filter, null, null, null, | ||
| handleThriftError(runDataList => { | ||
| if (runDataList.length !== 1) return; | ||
| ccService.getRunData(filter).then(runDataList => { |
There was a problem hiding this comment.
Why was .getClient() dropped from here? ccService has no exported function named getRunData.
Many report_server API functions have a limit parameter for limiting the number of results. When the parameter is 0 or None, then the MAX_QUERY_SIZE is used which is currently 500. Silently limiting the results may cause practical problems, too. For example, when we filter on runs with a joker character (e.g. myrun*) then the results from the first 500 runs return only.
3ef554a to
3601a39
Compare
Many report_server API functions have a limit parameter for limiting the number of results. When the parameter is 0 or None, then the MAX_QUERY_SIZE is used which is currently 500.
Silently limiting the results may cause practical problems, too. For example, when we filter on runs with a joker character (e.g. myrun*) then the results from the first 500 runs return only.