知识卡片
敏感信息不要进入URL
为资源生成标识时,避免把邮箱等个人信息放进 URL 路径或查询参数。URL 容易经过代理、缓存和日志,暴露面比业务字段更广;即使标识天然唯一,也要区分“能标识资源”和“适合公开流转”两件事。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- · 查看原书依据
It is possible to use the email field as a unique ID, however the Microsoft REST API Guidelines recommend in section 7.9 that personally identifiable information (PII) should not be part of the URL. Warning The reason for removing sensitive data from the URL is that paths or query parameters might be inadvertently cached in the network—for example, in server logs or elsewhere.
参考来源
- 位置:《Mastering API Architecture》第1章《Design, Build, and Specify APIs》之《REST API Standards and Structure》(源文件:_epub-src/OEBPS/ch01.xhtml)
- 结论依据:原文用邮箱作为用户唯一 ID 的候选,明确引用指南反对把个人信息写入 URL,并给出路径或查询参数可能进入缓存和日志的理由。
- 原始内容:It is possible to use the email field as a unique ID, however the Microsoft REST API Guidelines recommend in section 7.9 that personally identifiable information (PII) should not be part of the URL. Warning The reason for removing sensitive data from the URL is that paths or query parameters might be inadvertently cached in the network—for example, in server logs or elsewhere.