Skip to content

Proposal: Add 60-second rate limiting to send-otp function #140

Description

@cannonerd007

Hey everyone! While I was looking through the send-otp function in functions/send-otp/src/main.js, I noticed there isn't really anything stopping someone from hitting the endpoint repeatedly. This could lead to "OTP bombing" or just waste our API credits pretty quickly.

I’d like to add a 60-second cooldown logic. Basically, the function would check a last_otp_sent timestamp in the database before sending a new one, and return a 429 error if it’s too soon.

I've contributed to the Resonate-Website before and I'm planning to participate in GSoC 2026, so I'd love to help out on the backend side of things now. I've already forked the repo and have a good idea of how to implement this.

@M4dhav, could you please assign this to me so I can get a PR ready?

Activity

  1. M4dhav commented on Jan 14, 2026

    @M4dhav
    Contributor

    The rate-limit is already enforced on the frontend, the resend-otp button has a timeout of 60 seconds. Do you want to guard against direct requests?

  2. cannonerd007 commented on Jan 14, 2026

    @cannonerd007
    Author

    Exactly, @M4dhav. While the frontend timeout handles the user experience, the backend is currently vulnerable to direct API requests (e.g., via Postman or automated scripts).

    Implementing this on the backend ensures we protect our API quotas and prevent abuse regardless of where the request originates. It adds that essential 'second layer' of security for production readiness. I'd love to implement this server-side check to make the system more robust.

  3. M4dhav commented on Jan 14, 2026

    @M4dhav
    Contributor

    sounds good, make sure there's an early exit. Assigning

  4. added theissue type on Jan 14, 2026
  5. cannonerd007 commented on Jan 15, 2026

    @cannonerd007
    Author

    I've just submitted a PR for this (#141). I implemented the 60-second cooldown as an early exit at the start of the function and ensured the last_otp_sent timestamp updates in the database.

    I'm really enjoying contributing to Resonate and am looking forward to doing more. Please let me know if there are any other backend tasks or issues I can pick up next!

    #141

  6. Gallachandana1 commented on Jan 29, 2026

    @Gallachandana1

    Thanks for the clarification, mentors!
    I see the issue has already been implemented.
    I’m preparing for GSoC 2026 and would love to contribute to other backend issues in Resonate.
    Please let me know if there’s anything I can pick up next 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions