auth-wechat-miniprogram
使用 CloudBase 构建微信小程序认证
当 CloudBase 身份自动注入时,微信小程序认证很容易被误用。此技能为 wx.cloud、OPENID、UNIONID 和云函数提供实用模式。
使用我的智能体安装
将此请求复制给你的智能体,其中包含权威 Skill 页面和清单。
Review the Skillstore skill "auth-wechat-miniprogram" from https://skillstore.io/skills/tencentcloudbase-auth-wechat-miniprogram.md and its manifest at https://skillstore.io/api/skills/tencentcloudbase-auth-wechat-miniprogram/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.你的智能体仍应展示其计划,并按安全策略请求必要确认。
Agent 可读资源
当 AI Agent、爬虫或脚本需要干净上下文,而不是读取完整页面时,请使用这些链接。
测试它
正在使用“auth-wechat-miniprogram”。 用户询问如何在 CloudBase 云函数中识别调用方。
预期结果:
助手解释 CloudBase 调用方上下文、UNIONID 何时出现,以及如何只返回所需的身份字段。
正在使用“auth-wechat-miniprogram”。 用户需要为新的 CloudBase app 设置小程序认证。
预期结果:
助手询问环境 ID,确认 CloudBase 绑定,并概述 app 启动期间的初始化。
正在使用“auth-wechat-miniprogram”。 用户想在小程序中保护用户拥有的记录。
预期结果:
助手建议使用 OPENID 进行服务端所有权检查,并提醒不要信任客户端提供的 owner 字段。
安全审计
中风险Static detections are false positives caused by Markdown inline code, fenced JavaScript examples, reference URLs, and sibling skill paths. The review found two medium-risk content issues: an authorization example that relies on client-supplied owner data and examples that log sensitive identifiers.
已确认安全问题 (2)
风险因素
⚙️ 外部命令 (50)
🌐 网络访问 (4)
📁 文件系统访问 (2)
分享与引用此报告
分享版本化评估报告、中性徽章、嵌入卡片和引用。Skillstore 只报告证据,不判断该 Skill 是否安全。
复制报告链接
https://skillstore.io/skills/tencentcloudbase-auth-wechat-miniprogram/audits/2?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown 徽章
[](https://skillstore.io/skills/tencentcloudbase-auth-wechat-miniprogram?utm_source=security_passport_badge)HTML 徽章
<a href="https://skillstore.io/skills/tencentcloudbase-auth-wechat-miniprogram?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/tencentcloudbase-auth-wechat-miniprogram/security.svg" alt="Skillstore security assessment" loading="lazy"></a>嵌入卡片
<iframe src="https://skillstore.io/embed/skills/tencentcloudbase-auth-wechat-miniprogram.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>学术引用 (APA · BibTeX · CFF)
APA 引用
tencentcloudbase. (2026). auth-wechat-miniprogram security audit report (audit version 2) [Author version 2.23.8]. Skillstore. https://skillstore.io/skills/tencentcloudbase-auth-wechat-miniprogram/audits/2BibTeX 引用
@techreport{tencentcloudbase-tencentcloudbase-auth-wechat-miniprogram-2026,
author = {tencentcloudbase},
title = {auth-wechat-miniprogram security audit report (audit version 2)},
institution = {Skillstore},
year = {2026},
number = {2},
url = {https://skillstore.io/skills/tencentcloudbase-auth-wechat-miniprogram/audits/2},
note = {Author version 2.23.8}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "auth-wechat-miniprogram security audit report (audit version 2)"
version: "2.23.8"
type: report
authors:
- name: "tencentcloudbase"
date-released: "2026-07-09"
url: "https://skillstore.io/skills/tencentcloudbase-auth-wechat-miniprogram/audits/2"
identifiers:
- type: other
value: "skillstore:tencentcloudbase-auth-wechat-miniprogram:audit:2"
description: "Skillstore immutable audit report identifier"
Skillstore 评分
评分依据 证据置信度: 中你能构建什么
实现小程序身份识别
为微信小程序添加原生 CloudBase 身份处理,而无需构建单独的登录页面。
审查云函数认证
检查云函数在使用用户特定数据之前如何读取 OPENID、APPID 和 UNIONID。
选择原生认证或 Web 认证
判断某项功能应使用原生小程序身份,还是单独的 Web 认证流程。
试试这些提示
使用此技能为我的 CloudBase app 添加原生微信小程序认证。请先询问我缺失的 env 详细信息。
创建一个使用 wx-server-sdk 读取 OPENID、APPID 和 UNIONID 的云函数模式。包括错误处理指导。
帮我为小程序设计用户特定的数据库访问。安全使用 OPENID,并避免暴露标识符。
审查我的小程序 CloudBase 认证流程,检查原生登录假设、不安全的授权检查以及生产日志风险。
最佳实践
- 编写代码前确认 CloudBase 环境 ID 和小程序绑定。
- 使用来自 CloudBase 上下文中已验证的 OPENID 来做用户所有权决策。
- 将包含 OPENID、UNIONID 或手机号授权数据的日志视为敏感信息。
避免
- 不要为原生小程序认证构建 Web 风格的登录页面。
- 当 wx.cloud 已经传递调用方身份时,不要手动发送用户凭据。
- 不要将客户端提供的 owner 标识符作为唯一的授权检查。
常见问题
这会取代微信 OAuth 吗?
此技能可以配置 CloudBase 设置吗?
OPENID 总是可用吗?
什么时候应该使用 UNIONID?
它适用于 Claude Code 和 Codex 吗?
这些示例可以直接用于生产吗?
开发者详情
许可证
MIT
作者版本
v2.23.8
Skillstore 修订
r1
引用
24b2fe42a456262f3fd0fb3df72e12d9ed2c32ec
维护新鲜度
2026/7/18
使用量
1 次下载 · 0 次浏览
文件结构
📄 SKILL.md