Skip to content

MAX_LIMIT can be bypassed with params.limit = NaN #308

Open
@SeanLMcCullough

Description

@SeanLMcCullough

Tested using the Mongoose Plugin.

The test: if (params.limit > config.MAX_LIMIT) params.limit = config.MAX_LIMIT; can be bypassed if a programming error or edge case exists resulting in params.limit = NaN.

An example is when parsing a query param using params.limit = parseInt(ctx.query.limit, 10).

In this case, params.limit will remain as NaN because NaN > 300 === false.

MongoDB will treat that as an infinite limit and fetch all documents, bypassing the limit value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions