duanpu2272 2019-03-28 09:30
浏览 83

安全SMS发送API端点

Explanation

I have an API running on Laravel 5.8 that uses Nexmo Verify API in order to send a code by SMS for two things :

  • (1) User account creation (check phone number before creating the account)
  • (2) Forgotten password (check code sent before entering a new password)

This PHP API is used by an iOS Application and an Android Application.

In the first case (1), I have to check that the phone number does not exist before sending a SMS.
In the second case (2), I have to check that the phone number exists before sending a SMS.

So, I may have two API routes :

  • One checks if a phone number already exists, so that the mobile applications can display the next page or display an error.
  • The other one simply sends a sms code to a phone number.

Problem

The problem is that we can have a route that looks like /api/phone/sendcode and anyone can call this route directly without using the mobile application if they find what the endpoint is (it's just an API after all). It can be easy to use this route to spam.
Or, they also could call a route api/phone/exists tons of time to try to get all existing users.

Question

How can I secure the endpoints in order to avoid people using them directly to SPAM or to check in a loop if an account exists ?
I already have a throttling system to block a specific IP address to request an endpoint more that X times in a minute, but I think this is not enough and can be bypassed (using a proxy or whatever).

Also, I prefer to avoid using Captcha.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料