- 云开发如何避免CloudId的信息是用户直接传进来的?
https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/open/Cloud.CloudID.html 拿官网案例说 callFunction的参数是 wx.cloud.callFunction({ name: 'myFunction', data: { weRunData: wx.cloud.CloudID('xxx'), // 这个 CloudID 值到云函数端会被替换 obj: { shareInfo: wx.cloud.CloudID('yyy'), // 非顶层字段的 CloudID 不会被替换,会原样字符串展示 } } }) 小程序自动解析的event是 "weRunData": { "cloudID": "27_Ih-9vxDaOhIbh48Bdpk90DUkUoNMAPaNtg7OSGM-P2wPEk1NbspjKGoql_g", "data": { "stepInfoList": [ { "step": 9103, "timestamp": 1571673600 }, { "step": 9783, "timestamp": 1571760000 } ], "watermark": { "appid": "wx3d289323f5900f8e", "timestamp": 1574338655 } } }, "obj": { "shareInfo": "xxx" } 但是如果我是用于获取手机号、支付这种敏感的操作,我需要验证用户数据的真实性,我怎么知道这个数据不是用户伪造直接传给我的呢? 比如如下的调用方式: wx.cloud.callFunction({ name: 'myFunction', data: { weRunData: { "cloudID": "27_Ih-9vxDaOhIbh48Bdpk90DUkUoNMAPaNtg7OSGM-P2wPEk1NbspjKGoql_g", "data": { "stepInfoList": [ { "step": 9103, "timestamp": 1571673600 }, { "step": 9783, "timestamp": 1571760000 } ], "watermark": { "appid": "wx3d289323f5900f8e", "timestamp": 1574338655 } } }, obj: { shareInfo: "xxx", } } })
2021-11-07 - 云开发本地调试控制台SourceMap报错Unexpected end of JSON input?
云开发使用typescript转义的.map格式SourceMap文件会报这个警告,不止自己的代码有,包中代码的SourceMap一样会报错,实际SourceMap会提示detected,但是实际没有生效 [图片] 我调了一个比较简单的SourceMap生成结果贴上来,格式应该是没问题的 {"version":3,"file":"getClassName.js","sourceRoot":"","sources":["getClassName.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAC,GAAW;IACtC,IAAI,GAAG,IAAI,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE;QACxD,IAAG,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE;YACvB,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC;SAC7B;QACD,IAAI,GAAG,GAAG,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;QACrC,IAAI,GAAG,CAAC;QACR,IAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,EACvB;YACE,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC3C;aAAM;YACL,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;SACrC;QACD,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,EAAE;YAC1B,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;SACf;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAlBD,oCAkBC"}
2021-10-31