liveBook · Manning

Protected attributes

As explained in Secure APIs

Protected attributes are model properties configured to reject direct assignment through a mass-assignment mechanism.

Protected attributes are model properties that reject direct assignment through mass assignment. They prevent user-controlled payloads from binding sensitive fields to database objects. section 4.6.1

Preventing privilege changes

A signup endpoint that binds every submitted field could accept user[admin]=1 and create an administrator profile. Constrain input to permitted fields, such as amount and currency, while setting status and other protected properties separately. section 4.6.1

Check mass-assignment defenses by asking:

  • Can a request override status, role, ownership, or another field the user should not control? section 4.6.1
  • Does the endpoint validate and sanitize input before binding it to a database model? section 4.6.1
Figure 4.7 Mass assignment happens when a threat actor manages to override a field they shouldn’t be able to access, such as the status of a payment.
figure

Use the payment-status illustration to recognize mass assignment as unauthorized overriding of a protected field. section 4.6.1

How Secure APIs covers it

How deep it goes
Explains the attack, privilege impact, vulnerable binding, and constrained-input mitigation, but does not detail framework configuration syntax.
Examples
Uses an admin-profile signup payload and a payment request that attempts to set status to accepted.
What you can do after
Diagnose mass-assignment exposure and constrain request fields before binding user data to database models.
How it connects
Connects protected attributes with mass assignment, elevation of privilege, input validation, sanitization, and BOLA.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Secure APIs. The section links point to the parts of the book it draws on.