Skip to content
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

Added "sort" parameter to query processing #48

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

andreysolovyov
Copy link

The sort parameter passed to cursor on final step. Query parameter using "-" prefix to identify sorting direction.

The sort parameter passed to cursor on final step. Query parameter using "-" prefix to identify sorting direction.
Copy link
Contributor

@boutell boutell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good idea but we can't let arbitrary sort parameters be passed to mongodb, it can result in a denial of service very easily if there are enough documents and the specified sort is not indexed. It could also reveal hints about information not intended for API consumption.

There would need to be a process for whitelisting specific sorts (with their sort directions) to be permitted in API calls, and for specifying multiple-field sorts, like lastName,firstName, which MongoDB also supports.

It would need to work similarly to the mechanism for declaring fields safe for "distinct" calls via the API.

@abea abea changed the base branch from master to main August 14, 2020 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants