mass assignment

A bug where a handler copies every field of a request body into a data model, so a caller can set fields such as role or balance that were never meant to be writable.

A caller can promote themselves or rewrite money and ownership fields in one request.

In more detail

It turns a convenience, such as copying the whole body with update, into a way to set role, balance, owner or status. The fix is a per-operation allowlist of writable fields, rejecting unknown fields loudly, and responses built from named public fields.

Examples

In the course a signup request with role admin and balance 9999 produces a rich administrator, and an update rewrites status and owner.
{"name": "mallory", "role": "admin", "balance": 9999} sent to a signup endpoint

Related terms

Taught in

References