Test mass assignment: can a user set their own role?

A signup endpoint takes {"email": "…", "password": "…"}. What happens if you send {"email": "…", "password": "…", "role": "admin"}? If the server binds the body straight onto its user model, you just made yourself an administrator. That's mass assignment, part of "broken object property level authorization" in the OWASP API Top 10.

Find the dangerous fields

Look at a GET response for the object, not the docs for the POST. Fields that appear in the response but aren't meant to be written are the candidates:

JSON
{
  "id": "u_42",
  "email": "[email protected]",
  "role": "member",
  "emailVerified": false,
  "organizationId": "org_7",
  "creditBalance": 0,
  "createdAt": "2026-11-25T10:00:00Z"
}

Here: role, emailVerified, organizationId, creditBalance, createdAt, id. For orders, look for price, total, discount, status, paidAt.

Send them on purpose

Duplicate the normal update request and add the extra fields:

JSON
{
  "name": "Anna",
  "role": "admin",
  "emailVerified": true,
  "organizationId": "org_1",
  "creditBalance": 100000
}

Name it after the case: Update profile (tries to set role, 2xx or 400).

Check the effect, not the status

An API can do one of two correct things: reject the unknown fields with 400, or ignore them and update only name. Both are fine. What's not fine is applying them, and the status code doesn't tell you which happened.

So check the response body, and read the object back:

JavaScript
// Tests on "Update profile (tries to set role)"
pm.test('the request is refused or the forbidden fields are ignored', () => {
  if (pm.response.code === 400 || pm.response.code === 422) return;
  const user = pm.response.json();
  pm.expect(user.role).to.equal('member');
  pm.expect(user.emailVerified).to.equal(false);
  pm.expect(user.organizationId).to.equal(pm.environment.get('organizationId'));
  pm.expect(user.creditBalance).to.equal(0);
});

If the update returns no body, add a Get profile request right after it with the same checks. A response can say one thing while the database holds another.

Create requests too

Mass assignment is as common on create as on update. Sign up with "role": "admin", or create an order with "total": 0.01, and check the result:

JavaScript
pm.test('the client cannot set the order total', () => {
  const order = pm.response.json();
  pm.expect(order.total).to.be.above(1);
});

Nested objects

Frameworks that bind nested JSON can let {"profile": {"user": {"role": "admin"}}} through when {"role": "admin"} is blocked. If your bodies are nested, try the dangerous field at each level.

Keep them in a folder

Put these requests in a Security folder next to the authorization tests and run it in CI. When someone adds a field to a model and forgets the allowlist, the test catches it before a user does.