hexo-theme-fluid
hexo-theme-fluid copied to clipboard
LeanCloud 统计避免恶意篡改
请确认
- [x] 是当前最新的 Release 版本
- [x] 在 用户指南 中没有找到解决办法
问题描述
使用 LeanCloud 统计访问量,发现可以访问 API 实现恶意篡改访问量。
示例
import requests
print(requests.put(
'https://n7i9euyn.api.lncldglobal.com/1.1/classes/Counter/xxx',
json={"time": 200},
headers={
'x-lc-id': 'xxx',
'x-lc-key': 'xxx'
}
).json())
URL 的参数在请求返回中:
ID 和 Key 在请求头中:
我已成功在我的博客和 您的博客 测试以上代码篡改访问量成功。
尝试的解决方案
- 官方文档的 安全域名 设置,没有效果
另外可以参考 https://leaferx.online/2018/02/11/lc-security/ 前半部分
去设置 beforeUpdate
参数校验,我的博客已经加上去了
补充一点:需要修改 LeanCloud 数据库权限,仅保留 find
和 update
即可