• 请不要在回答技术问题时复制粘贴 AI 生成的内容
Zach369
V2EX  ›  程序员

如何保证 api 接口的安全?

  •  
  •   Zach369 · Jun 15, 2020 · 3136 views
    This topic created in 2187 days ago, the information mentioned may be changed or developed.

    需求: 给第三方提供 api. 目前分类了 app_key; 那么 如何保证 api 的安全行那?

    1. 防止重复调用
    2. 防止被别人抓到接口非法构造参数调用
    

    多谢

    4 replies    2020-06-15 12:50:17 +08:00
    securityCoding
        1
    securityCoding  
       Jun 15, 2020
    1. 幂等
    2. 链路安全靠 https , 参数安全靠加签
    带着你的问题,看看大厂的 api 调用规范就明白了,比如支付宝
    wysnylc
        2
    wysnylc  
       Jun 15, 2020
    1 楼说得对,抄支付宝
    xycool
        3
    xycool  
       Jun 15, 2020
    最简单实现的白名单 ip
    firefox12
        4
    firefox12  
       Jun 15, 2020
    搭车问一个问题 一个 app 可能需要去调用一个第三方 app, 那个第三方 给了你 app_key 和 token, 你不能把这个放在 app 里面,否则反编译就暴露了, 但是每次去服务器拿其实也和裸奔差不多。唯一的办法 就是调用者 变成服务器,app 去服务器拿,服务器去第三方 app 拿,有更好的安全方案吗?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   997 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 22:27 · PVG 06:27 · LAX 15:27 · JFK 18:27
    ♥ Do have faith in what you're doing.