Skip to content

Allow for mongoRateLimited to create more than one "audit trail" for each request #1

@mansona

Description

@mansona

Example:

you have an endpoint /createNote that you have setup with a rateLimit authmakerVerifyExpress.mongoRateLimited("createNote") and you are currently sending a single note per request so this just works. i.e. there is a one to one relationship between requests and the number of notes that you are creating.

say you upgrade your endpoint to be able to take a number of notes at once because fewer http requests are awesome 🎉 ... well now you might say have a limit of 10 notes created per day, the user calls /createNote 9 times with one note and then calls it once with 10 notes. The current implementation allows for a user to now have created 19 notes in a single day.

The way to solve this is to provide an optional function to the authmakerVerifyExpress.mongoRateLimited("createNote") call that gets passed req as its only parameter. this function will then return the number of audit trail items that it should create as part of this request and pass that down into authmaker-verify.

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