知识卡片

普通读书笔记卡 · 3265

防止请求字段越权绑定

理解等级:高级

把客户端请求直接绑定到内部数据对象,可能让只读或管理员字段被意外修改。服务应明确允许更新的字段及权限,再映射到内部实体;不能期望网关通用校验替代领域对象的授权和写入规则。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      Mass Assignment is typical where client input data is bound to internal objects without thought of the repercussions, which is often a consequence when exposing a database API as a web-based API. In Chapter 1 the concerns of exposing an underlying data model are discussed from a usability point of view, which provides additional reasons not to do this.

    参考来源

    - 位置:《Mastering API Architecture》第6章《Operational Security: Threat Modeling for APIs》之《Step 4: Identify Threats—Taking This in Your STRIDE》(源文件:_epub-src/OEBPS/ch06.xhtml) - 结论依据:原文用设备列表被 PUT 请求篡改的案例解释 mass assignment,并指出此问题通常需在 API 实现内部防护。 - 原始内容:Mass Assignment is typical where client input data is bound to internal objects without thought of the repercussions, which is often a consequence when exposing a database API as a web-based API. In Chapter 1 the concerns of exposing an underlying data model are discussed from a usability point of view, which provides additional reasons not to do this.