fix: 云函数鉴权加固与投票数据防护
- follow/cms-vote/cms-articles-like/cms-articles-collect 云对象写操作强制 checkToken,uid 以服务端令牌为准,杜绝客户端伪造身份 - user-info.getIP 仅允许查询本人登录 IP(get_user_info 公开资料保持不变) - ext-storage-co 上传凭证需登录,删除文件仅限 admin 角色(原为完全裸奔) - cms-vote/cms-vote-info/user_select_vote 三表 schema 写权限全部关闭(投票读写均走云对象) - 修复 follow.reFollow 中 total<0 永假导致的逻辑错误 - 各云对象 package.json 补 uni-id-common 依赖声明 - main.js 登录过期跳转修正为实际页面路径 /pages/login/login
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
|
||||
const uniID = require('uni-id-common');
|
||||
|
||||
const extStorageManager = uniCloud.getExtStorageManager({
|
||||
provider: "qiniu",
|
||||
domain:"qnycdn.mymoyu.top",
|
||||
@@ -10,7 +12,9 @@ module.exports = {
|
||||
_before: function() {
|
||||
|
||||
},
|
||||
getUploadFileOptions(data = {}) {
|
||||
async getUploadFileOptions(data = {}) {
|
||||
const { errCode } = await uniID.createInstance({ context: this.getClientInfo() }).checkToken(this.getUniIdToken());
|
||||
if (errCode) throw new Error('请先登录后再上传文件');
|
||||
let {
|
||||
cloudPath
|
||||
} = data;
|
||||
@@ -48,6 +52,8 @@ module.exports = {
|
||||
// },
|
||||
// // 删除文件
|
||||
async deleteFile(data = {}) {
|
||||
const { role, errCode } = await uniID.createInstance({ context: this.getClientInfo() }).checkToken(this.getUniIdToken());
|
||||
if (errCode || !(role || []).includes('admin')) throw new Error('仅管理员可删除文件');
|
||||
let {
|
||||
fileList
|
||||
} = data;
|
||||
|
||||
Reference in New Issue
Block a user