启用属性回调后,登录会把身份邮箱写入应用状态
原文依据:5 处该 Skill 建议在登录回调中接收身份提供商属性,并示例将邮箱按主体写入持久应用状态。此收集发生在每次登录回调中,不只是用户主动填写资料时。
应用会持有可识别个人的邮箱数据;任何后续备份、管理接口、状态导出或应用漏洞都可能扩大该数据的暴露范围。
该风险有条件地成立:只有应用把非空回调传给 `MixinAuthorization` 时,已验证的姓名、邮箱和 SSO 属性才会在每次登录时交给应用。示例把邮箱按主体写入应用的 `emails` 映射,并提供当前登录者读取自己邮箱的接口。用户可要求作者说明保存期限、删除方式及具体用途,或要求保持第二个参数为 `null`、仅收集必要属性。源码没有显示邮箱被发送到外部服务。
`MixinAuthorization` can capture the user's verified Internet Identity attributes (name and email) at sign-in. Pass a callback as the second argument instead of `null`; it runs once per sign-in, after the attribute bundle has been verified.查看另外 4 个位置
Store them in your own state and expose a getter to read them back: let emails : Map.Map<Principal, Text>; include MixinAuthorization( accessControlState, ?(func(caller : Principal, attrs : { name : ?Text; email : ?Text; sso : ?Text }) { switch (attrs.email) { case (?email) { emails.add(caller, email) }; case null {}; }; }), include MixinAuthorization( accessControlState, ?(func(caller : Principal, attrs : { name : ?Text; email : ?Text; sso : ?Text }) { switch (attrs.email) { case (?email) { emails.add(caller, email) }; case null {}; }; }), ); public query ({ caller }) func getCallerEmail() : async ?Text { emails.get(caller); };};