我最近因涉嫌开放扫描而收到一封电子邮件: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 文件。
在上面发布的链接中,提供了缓解示例,但我认为它们适用于可以控制其服务器的人——我运行 Firebase 托管并且似乎没有这样的控制权。
问题:
- 这是一个安全漏洞吗?
- 如果是这样,我该如何缓解?
最佳答案
最简单的方法可能是使用 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/