git - 如何修复 .git 暴露的 firebase 漏洞

标签 git firebase security firebase-hosting

我最近因涉嫌开放扫描而收到一封电子邮件:https://smitka.me/

它指出:

The problem is you have a publicly available git repository on your website. You can check it by visiting /.git/HEAD. When you visit the directory /.git you usually get 403 error because there is no index.html/.php file and you don’t allow to show the directory listing/autoindex (if you can see the directory structure you have a misconfigured webserver – it is another type of vulnerability). Despite 403 it is possible to access the files directly. This is the way I found your e-mail address – from the /.git/logs/HEAD – it is the list of commits with details about commiteers.

我不是这方面的专家,我只是使用 firebase 控制台部署了我的网站。我使用 git 将我的文件夹置于版本控制之下,并且 屏幕截图将显示项目文件夹根目录中的文件夹结构,并显示 stash 文件。

Folder structure

在上面发布的链接中,提供了缓解示例,但我认为它们适用于可以控制其服务器的人——我运行 Firebase 托管并且似乎没有这样的控制权。

问题:

  1. 这是一个安全漏洞吗?
  2. 如果是这样,我该如何缓解?

最佳答案

最简单的方法可能是使用 firebase.json 从部署中排除目录 .git:

{
  "database": {
    "rules": "database.rules.json"
  },
  "hosting": {
    ...
    "ignore": [
      "README.md",
      "firebase.json",
      ".firebaserc",
      ".git",
      ".gitignore",
      ".idea",
      ...
    ]
  }
}

底线是:只部署为页面提供服务所必需的内容。

关于git - 如何修复 .git 暴露的 firebase 漏洞,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52047261/

相关文章:

git - netbeans cordova-构建我的项目时出错

Git:在提交并推送到远程存储库之前检查可能的冲突

git - 如何使用私有(private)分支或存储库公开我的点文件?

android - Flutter Firebase和Android问题-无法初始化。找不到执行了最新(2020年9月)迁移说明的google-services.json

git - 检查现有的远程分支

java - 如何在firebase数据库中添加数据

swift - 当节点值未知/自动生成 Swift 时更新 Firebase 中的子值

java - 使用 BouncyCaSTLe 创建 key 对证书并使用外部 CA 对其进行签名

java - 将明文密码*暂时*存储在 MySQL 中是否安全?

php - 如何在不直接访问文件的情况下在网站上提供可下载的发票?