仅从Chrome扩展程序安全访问API [英] Secure access to api only from chrome extension

查看:47
本文介绍了仅从Chrome扩展程序安全访问API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力允许chrome扩展程序通过发布数据将新条目发布到我的网站.

I am working on allowing a chrome extension to post a new entry to my site via post data.

我希望能够将其锁定,以便只有chrome扩展程序可以发布.如果我从其他任何地方获取发布数据,我想拒绝它.

I want to be able to lock it down so only the chrome extension can post. If I get post data from anywhere else I want to reject it.

有人知道是否/如何做到这一点,或者您将如何去做?

Does anyone know if/how this is possible or how you would go about doing it?

推荐答案

不幸的是,从Web服务器验证客户端(无论是Chrome扩展程序,Android应用程序,iOS应用程序,客户端JavaScript还是其他客户端)是一个尚未解决的问题.

Unfortunately, validating clients (whether a Chrome extension, an Android app, an iOS app, client-side JavaScript, or some other client) from a web server is an unsolved problem.

您可以采取一些措施来制止滥用并减轻此问题,例如:

There are some things that you can do to deter abuse and mitigate this problem such as:

  • 要求用户身份验证(以及每个用户的速率限制使用)
  • 基于IP地址的限速访问
  • 需要提供在先前请求中分发的令牌(可用于确保以某些预期的顺序/模式调用某些API).
  • 显示正畸或超限使用的验证码或其他挑战

尽管您可以使用任何分布式应用程序额外检查用户代理,引荐来源网址或嵌入在Chrome扩展程序中的令牌等内容,但很容易对它们进行反向工程并将其模仿在伪造的应用程序中,并且所以这些不是真正的解决方案.

While you can additionally check things such as user agent, referrer URL, or a token that you embed in the Chrome extension, with any distributed application, it is easy to reverse-engineer these and mimick them in a counterfeit app, and so these aren't true solutions.

这篇关于仅从Chrome扩展程序安全访问API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆