Problem Statement
Which situation best describes Mass Assignment in an API?
Explanation
Mass assignment is when incoming fields are mapped to object properties by default. Attackers add extra fields in the JSON body to set flags like isAdmin, isVerified, or discount. If the server does not filter fields, the change sticks.
Mitigate with allow lists for writable fields, separate DTOs from persistence models, and test by fuzzing unexpected property names.
Code Solution
SolutionRead Only
POST /api/profile { "email": "a@b.com", "isAdmin": true }
// Server must drop isAdmin and only accept allowed fields