简体   繁体   English

如何在客户端Javascript中保护Firebase

[英]How to Secure Firebase in client side Javascript

I am using Firebase with Ruby on Rails (4.0.3). 我将Firebase与Ruby on Rails(4.0.3)一起使用。 The Client side JS is listening for events on a particular URL. 客户端JS正在侦听特定URL上的事件。 Obviously, the URL is visible to the client, and adding any token based authentication is useless since that'd be visible too. 显然,URL对客户端是可见的,并且添加任何基于令牌的身份验证都是无用的,因为这也是可见的。 Whats the way around this? 怎么办呢?

Firebase supports a system of security rules that define who can read or write information in your Firebase. Firebase支持一个安全规则系统,该规则定义了谁可以读取或写入Firebase中的信息。 You define them by writing json like this: 您可以通过编写json来定义它们,如下所示:

{
  "rules": {
    "foo": {
      // /foo/ is readable by the world
      ".read": true,

      // /foo/ is writable by the world
      ".write": true,

      // data written to /foo/ must be a string less than 100 characters
      ".validate": "newData.isString() && newData.val().length < 100"
    }
  }
}

There's a whole lot more to this topic than is appropriate to put in a Stack Overflow answer, so please check out Firebase's official documentation on security . 关于这个问题,除了要提出Stack Overflow答案之外,还有很多其他内容,因此请查阅Firebase的安全性官方文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase云消息传递在客户端的安全性如何? - How secure is firebase cloud messaging at client side? 如何通过全客户端实现来保护 Firebase? - How can I secure Firebase with an all client-side implementation? 如何从插件/扩展中隐藏/保护客户端JavaScript中的会话/加密密钥 - How to hide/secure session/encryption key in client side javascript from addon/extension 这个客户端应用程序安全吗? - Is this client side application secure? 在iOS Safari和Chrome中使用客户端JavaScript设置安全Cookie - Set secure cookie with client-side javascript in ios safari and chrome 是否可以使用客户端javascript连接到sftp服务器。 安全吗? - Is it possible to connect to sftp server using client side javascript. Is it secure? 客户端Java本质上不如JavaScript安全吗? - Is client-side java intrinsically less secure than javascript? 如何让Javascript客户端创建安全的UUID? - How to have a Javascript client create a secure UUID? 如何在客户端验证email是否在firebase中验证? - How to check if email is verified in firebase on client side? 从客户端(浏览器)调用DialogFlow时如何确保安全? - How to secure when make a call to DialogFlow from Client side (browser)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM