Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LeanCloud 统计避免恶意篡改 #763

Closed
2 tasks done
AnzhiZhang opened this issue Jun 9, 2022 · 3 comments
Closed
2 tasks done

LeanCloud 统计避免恶意篡改 #763

AnzhiZhang opened this issue Jun 9, 2022 · 3 comments
Labels
🍻 good first issue Good issue for first-time contributors ✨ enhancement New feature request

Comments

@AnzhiZhang
Copy link

请确认

问题描述

使用 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 的参数在请求返回中:
image
ID 和 Key 在请求头中:
image

我已成功在我的博客和 您的博客 测试以上代码篡改访问量成功。

尝试的解决方案

@zkqiang
Copy link
Member

zkqiang commented Jun 9, 2022

安全域名只对 JavaScript SDK 有效

后续计划通过类似于 hexo-leancloud-counter-security 来解决这个问题

@zkqiang
Copy link
Member

zkqiang commented Jun 9, 2022

另外可以参考 https://leaferx.online/2018/02/11/lc-security/ 前半部分

去设置 beforeUpdate 参数校验,我的博客已经加上去了

@zkqiang zkqiang added the ✨ enhancement New feature request label Jun 9, 2022
@zkqiang zkqiang changed the title Help Wanted:LeanCloud 访问量统计如何避免恶意篡改 LeanCloud 统计避免恶意篡改 Jun 9, 2022
@AnzhiZhang
Copy link
Author

补充一点:需要修改 LeanCloud 数据库权限,仅保留 findupdate 即可

@zkqiang zkqiang added the 🍻 good first issue Good issue for first-time contributors label Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍻 good first issue Good issue for first-time contributors ✨ enhancement New feature request
Projects
None yet
Development

No branches or pull requests

2 participants