Mass assignment
Definition
Mass assignment happens when a framework copies request properties directly onto a persistence object, so a client can write fields that are meant to be read-only or privileged (part of OWASP API3:2023).
In practice
It is convenient to bind JSON straight onto an ORM entity, and it works until someone adds "role":"admin" or "balance":1000000 to a profile update. Attackers find such fields by reading responses, which often expose the whole row (excessive data exposure, the other half of API3).
Bind requests to explicit input models with an allowlist of writable fields, decide per field whether this caller may write it, and serialise responses through explicit output models. Blocklisting dangerous fields fails as soon as a new one is added. Schema validation with additionalProperties: false adds a second layer.
Example
PATCH /users/me with {"name":"Ana","is_admin":true} makes Ana an admin because the handler does user.update(req.body); an UpdateProfile model accepting only name and avatar fixes it.