信息泄露
敏感信息是指一旦泄露,可能会给开发者的业务、合作伙伴和用户带来利益损害的数据,包括但不限于账号 Appsecret、特权账号信息、后台加密密钥、登录账户密码、用户身份证号、手机号、银行卡号等。
开发建议:
- 敏感信息不应以明文、注释、可逆的编码方式(如 base64)、不安全散列函数(如 MD5、 SHA1)等形式出现在微信小程序文件内。
- 部分敏感信息如用户的银行卡号、手机号等需要用于展示的,需要进行脱敏处理。常用脱敏规范如下:
| 敏感信息类型 |
展示样例 |
姓名
|
名字只有两个字,对第一个字打码,如:*三。 多于两个字,只保留第一个和最后一个,其余都打码,如:王*四、欧**五
|
身份证
|
只显示第一位和最后一位,如:3*******************1
|
手机号
|
除去手机国际码后,手机号位数不少于10位时,只显示前三位和最后两位,如:156******77。手机号位数少于10位时,只显示前两位和后两位,如:12*****89。国家码可以完全显示。
|
银行卡
|
只显示最后4位,如:************1234
|
- 如果微信小程序存在敏感信息泄露的问题,微信开放平台将有可能下架该微信小程序,并暂停该微信小程序的相关服务。
授权用户信息变更
- 授权用户资料变更:当部分用户的资料存在风险时,平台会对用户资料进行清理,并通过消息推送服务器通知最近30天授权过的微信小程序开发者,我们建议开发者留意响应该事件,及时主动更新或清理用户的头像及昵称,降低风险。
- 授权用户资料撤回:当用户撤回授权信息时,平台会通过消息推送服务器通知给微信小程序开发者,请开发者注意及时删除用户信息。
- 授权用户完成注销:当授权用户完成注销后,平台会通过消息推送服务器通知给微信小程序开发者,请依法依规及时履行相应个人信息保护义务,保护用户权益。
点击查看消息推送服务器配置
事件推送示例:
XML
<xml>
<ToUserName><![CDATA[gh_870882ca4b1]]></ToUserName>
<FromUserName><![CDATA[owAqB1v0ahK_Xlc7GshIDdf2yf7E]]></FromUserName>
<CreateTime>1626857200</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[user_authorization_revoke]]></Event>
<OpenID><![CDATA[owAqB1nqaOYYWl0Ng484G2z5NIwU]]></OpenID>
<AppID><![CDATA[wx13974bf780d3dc89]]></AppID>
<RevokeInfo><![CDATA[1]]></RevokeInfo>
<PluginID><![CDATA[wx13974bf780d3dc89]]></PluginID>
< OpenPID><![CDATA[G7esq5NVzP76HIHoB95t4CVBP6to]]></OpenPID>
</xml>
JSON
{
"ToUserName": "gh_870882ca4b1",
"FromUserName": "oaKk346BaWE-eIn4oSRWbaM9vR7s",
"CreateTime": 1627359464,
"MsgType": "event",
"Event": "user_authorization_revoke",
"OpenID": "oaKk343WOktAaT2ygsX138BGblrg",
"AppID": "wx13974bf780d3dc89",
"RevokeInfo": "1",
"PluginID": "wx13974bf780d3dc89",
"OpenPID": " G7esq5NVzP76HIHoB95t4CVBP6to"
}
事件字段定义
| 属性 |
类型 |
说明 |
| ToUserName |
string |
微信小程序的UserName
|
| FromUserName |
string |
平台推送服务UserName
|
| MsgType |
string |
默认为:Event
|
| Event |
string |
user_info_modified:用户资料变更,user_authorization_revoke:用户撤回,user_authorization_cancellation:用户完成注销;
|
| CreateTime |
number |
发送时间
|
| OpenID |
string |
授权用户OpenID
|
| UnionID |
string |
授权用户UnionID
|
| AppID |
string |
微信小程序的AppID
|
| RevokeInfo |
string |
用户撤回的授权信息,1:车牌号,2:地址,3:发票信息,4:蓝牙,5:麦克风,6:昵称和头像,7:摄像头,8:手机号,12:微信运动步数,13:位置信息,14:选中的图片或视频,15:选中的文件,16:邮箱地址,18:选择的位置信息,19:昵称输入键盘中选择的微信昵称,20:获取用户头像组件中选择的微信头像
|
| PluginID |
string |
插件场景用户撤回,插件的AppID
|
| OpenPID |
string |
插件场景用户撤回,撤回用户的OpenPID
|
微信小程序违规处罚信息通知
当微信小程序存在违规行为时,平台会通过消息推送服务器通知给微信小程序开发者,建议微信小程序开发者注意及时接收相关通知进行排查整改,此通知不影响已有的站内信等通知方式。
点击查看消息推送服务器配置
1. 事件字段定义
- 字段【Event】等于”wxa_punish_event”时,则表示这是一条关于【微信小程序违规处罚事件】的通知。
| 属性 | 类型 | 说明 |
| Event | string | 事件名称:wxa_punish_event,即微信小程序违规处罚信息 |
| event_type | number | 事件类型。1:警告;2:功能封禁;3:下架;4:账号封禁;10:页面封禁。 |
| punish_id | string | 违规处罚ID,用于唯一标识每次违规 |
| appid | string | 被处罚微信小程序的AppID |
| punish_time | number | 违规时间(UNIX时间戳) |
| illegal_reason | string | 违规原因 |
| illegal_content | string | 违规内容 |
| rule_name | string | 违反规则名称 |
| rule_url | string | 违反规则链接 |
| adjust_guide_url | string | 违规申诉及整改指引链接 |
| detail | string | 违规处罚详情,字段内容为JSON字符串,JSON具体结构取决于event_type,请参照下方说明对该字段中包含的JSON字符串进行正确的解析 |
1.2违规处罚事件详情(detail详细释义)
- 当event_type=1时detail中的JSON字符串结构如下:
| 属性 | 类型 | 说明 |
| warned_type | number | 警告类型。1:警告账号封禁;2:警告功能封禁;3:警告下架。 |
| rectify_deadline | number | 警告的截止时间(UNIX时间戳) |
| warned_function_names | array | 警告要封禁的功能项列表,如需获取列表中每个功能项的封禁时长,可直接在warned_ban_days的对应索引处获得,warned_function_names和warned_ban_days总是一一对应。(该字段仅当warned_type=2时生效) |
| warned_ban_days | array | 警告封禁的天数列表。当warned_type=1时则该列表仅有一项,代表警告要封禁微信小程序账号的天数。当warned_type=2时列表中的每一项分别代表warned_function_names中对应索引处的功能项被警告要封禁的天数。当warned_type=3时则该列表仅有一项,代表警告要下架微信小程序的天数。注:0代表永久封禁 |
- 当event_type=2时detail中的JSON字符串结构如下:
| 属性 | 类型 | 说明 |
| banned_days | array | 功能项被封禁的天数列表,列表中的每一项分别代表banned_function_names中对应索引处的功能项被封禁的天数。注:0代表永久封禁 |
| banned_function_names | array | 被封禁的功能项列表,如需获取列表中每个功能项的封禁时长,可直接在banned_days的对应索引处获得,banned_days和banned_function_names总是一一对应。 |
- 当event_type=3时detail中的JSON字符串结构如下:
| 属性 | 类型 | 说明 |
| suspended_days | number | 下架天数。注:0代表永久下架 |
- 当event_type=4时detail中的JSON字符串结构如下:
| banned_days | number | 微信小程序账号封禁天数。注意:0代表永久封禁 |
- 当event_type=5时,detail中的JSON字符串结构如下:
| 属性 | 类型 | 说明 |
| path | string | 微信小程序中被封禁的页面路径 |
2. 事件推送参数示例
{
"ToUserName": "gh_1d6c1222test",
"FromUserName": "oyeHc4i5LqBbWLVTfnhf-3TZ4BNk",
"CreateTime": 1699803867,
"MsgType": "event",
"Event": "wxa_punish_event",
"punish_id": "649557",
"appid": "wx54a8eaa26606test",
"punish_time": 1699803865,
"illegal_reason": "存在诱导分享行为",
"illegal_content": [
"违规内容测试"
],
"detail": "{\"warned_type\":1,\"rectify_deadline\":1699796571,\"warned_function_names\":[],\"warned_ban_days\":[3]}",
"rule_url": "/miniprogram/product/index.html#_5-1-滥用分享行为",
"rule_name": "《微信小程序平台运营规范》5.行为规范-5.1滥用分享行为",
"adjust_guide_url": "https://mp.weixin.qq.com/s/73rLZmwPeQ87Q89DYQcfkw",
"event_type": 1
}
{
"ToUserName": "gh_1d6c1222test",
"FromUserName": "oyeHc4pIdqHZwh80SufyUuIzSenw",
"CreateTime": 1699795665,
"MsgType": "event",
"Event": "wxa_punish_event",
"punish_id": "649551",
"appid": "wx54a8eaa26606test",
"punish_time": 1699795663,
"illegal_reason": "存在诱导分享行为",
"illegal_content": [
"违规内容测试"
],
"detail": "{\"warned_type\":2,\"rectify_deadline\":1699796571,\"warned_function_names\":[\"分享朋友圈\",\"客服消息接口\"],\"warned_ban_days\":[1,1]}",
"rule_url": "/miniprogram/product/index.html#_5-1-滥用分享行为",
"rule_name": "《微信小程序平台运营规范》5.行为规范-5.1滥用分享行为",
"adjust_guide_url": "https://mp.weixin.qq.com/s/73rLZmwPeQ87Q89DYQcfkw",
"event_type": 1
}
{
"ToUserName": "gh_1d6c1222test",
"FromUserName": "oyeHc4tGxCvPcXlKeFI5tU0jV_yw",
"CreateTime": 1699795665,
"MsgType": "event",
"Event": "wxa_punish_event",
"punish_id": "649551",
"appid": "wx54a8eaa26606test",
"punish_time": 1699795663,
"illegal_reason": "存在诱导分享行为",
"illegal_content": [
"违规内容测试"
],
"detail": "{\"warned_type\":3,\"rectify_deadline\":1699796571,\"warned_function_names\":[],\"warned_ban_days\":[1]}",
"rule_url": "/miniprogram/product/index.html#_5-1-滥用分享行为",
"rule_name": "《微信小程序平台运营规范》5.行为规范-5.1滥用分享行为",
"adjust_guide_url": "https://mp.weixin.qq.com/s/73rLZmwPeQ87Q89DYQcfkw",
"event_type": 1
}
{
"ToUserName": "gh_1d6c1222test",
"FromUserName": "oyeHc4gSrT2S8jG2Ll1ZS16rwqQk",
"CreateTime": 1699791600,
"MsgType": "event",
"Event": "wxa_punish_event",
"punish_id": "13577492",
"appid": "wx54a8eaa26606test",
"punish_time": 1699791599,
"illegal_reason": "存在诱导分享行为",
"illegal_content": [
"违规内容测试"
],
"detail": "{\"banned_days\":[1,1],\"banned_function_names\":[\"分享朋友圈\",\"客服消息接口\"]}",
"rule_url": "/miniprogram/product/index.html#_5-1-滥用分享行为",
"rule_name": "《微信小程序平台运营规范》5.行为规范-5.1滥用分享行为",
"adjust_guide_url": "https://mp.weixin.qq.com/s/73rLZmwPeQ87Q89DYQcfkw",
"event_type": 2
}
{
"ToUserName": "gh_1d6c1222test",
"FromUserName": "oyeHc4qHkaYV-0NYupPZBTBrBNuw",
"CreateTime": 1699801563,
"MsgType": "event",
"Event": "wxa_punish_event",
"punish_id": "13577869",
"appid": "wx54a8eaa26606test",
"punish_time": 1699801560,
"illegal_reason": "存在诱导分享行为",
"illegal_content": [
"违规内容测试"
],
"detail": "{\"suspended_days\":1}",
"rule_url": "/miniprogram/product/index.html#_5-1-滥用分享行为",
"rule_name": "《微信小程序平台运营规范》5.行为规范-5.1滥用分享行为",
"adjust_guide_url": "https://mp.weixin.qq.com/s/73rLZmwPeQ87Q89DYQcfkw",
"event_type": 3
}
{
"ToUserName": "gh_1d6c1222test",
"FromUserName": "oyeHc4jjAdCWq1klrk-puPMe0FC4",
"CreateTime": 1699784111,
"MsgType": "event",
"Event": "wxa_punish_event",
"punish_id": "9328325",
"appid": "wx54a8eaa26606test",
"punish_time": 1699784109,
"illegal_reason": "存在诱导分享行为",
"illegal_content": [
"测试违规内容/证据"
],
"detail": "{\"banned_days\":3}",
"rule_url": "/miniprogram/product/index.html#_5-1-滥用分享行为",
"rule_name": "《微信小程序平台运营规范》5.行为规范-5.1滥用分享行为",
"adjust_guide_url": "https://mp.weixin.qq.com/s/73rLZmwPeQ87Q89DYQcfkw",
"event_type": 4
}
{
"ToUserName": "gh_1d6c1222test",
"FromUserName": "oyeHc4n0I6U3A4Fq7tfOAqmAJy8E",
"CreateTime": 1699802583,
"MsgType": "event",
"Event": "wxa_punish_event",
"punish_id": "94185814",
"appid": "wx54a8eaa266009d6a",
"punish_time": 1699802425,
"illegal_reason": "发布低俗、性暗示或色情信息",
"illegal_content": [
"测试证据"
],
"detail": "{\"path\":\"pages/fengjin/fengjin\"}",
"rule_url": "/miniprogram/product/index.html#_6-2-色情低俗内容",
"rule_name": "《微信小程序平台运营规范》6.信息内容规范-6.2色情低俗内容",
"adjust_guide_url": "https://mp.weixin.qq.com/s/73rLZmwPeQ87Q89DYQcfkw",
"event_type": 10
}