知识卡片
拒绝访问与存在性
若调用者有权知道资源存在,403 可以明确指出当前动作不允许。若资源存在性也需保护,按一致对外策略返回 404,并检查响应正文没有矛盾信息。实际授权仍由服务判定。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- The API prerelease checklist 21.9 Improving security · 查看原书依据
Let’s consider another example: if Bob is allowed to read /foos/bobs-thing with a GET, but is not allowed to update it, what status code should we respond with when Bob tries PUT /foos/bobs-thing? Here, a 403 Forbidden response is perfectly acceptable, as
参考来源
- 位置:《Designing APIs with Swagger and OpenAPI》第21章《The API prerelease checklist》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch21.htm,阅读块 177)
- 结论依据:原文比较调用者是否已经有权知晓资源的两个场景。
- 原始内容:Let’s consider another example: if Bob is allowed to read /foos/bobs-thing with a GET, but is not allowed to update it, what status code should we respond with when Bob tries PUT /foos/bobs-thing? Here, a 403 Forbidden response is perfectly acceptable, as