QuizzifyTech

Bug library › API testing

API testing · Profile API

Normal user makes themselves admin by adding "role" to a profile update

P1 · CriticalExperiencedProfile API

Want to find it yourself first? This page gives away the answer. Play this bug on a fake app screen and see if you can spot it in three tries.

Spot this bug

The clue

Should a user be able to change every field?

Steps to reproduce

  1. Sign in as a normal user
  2. Send PATCH /api/me with {"name": "Riya S", "role": "admin"}

Expected result

Only safe fields like name change. "role" is ignored or rejected with 403.

Actual result

The response shows "role": "admin"

Why it matters

This is a critical (P1) bug. It can lose money, expose private data or stop people from finishing a key task. A bug like this should block a release and be fixed straight away.

Testing tip

Add extra fields (role, is_admin, balance, user_id) to update requests. The server must only accept fields the user may change.

How to find bugs like this

API bugs live in the JSON between the app and the server: wrong records returned, fields that leak private data, bad status codes and limits that are not enforced. When you test, try these checks:

  • Read the whole response body, not only the status code.
  • Ask for other users’ records on purpose.
  • Look for fields that should never leave the server.
  • Send values at and past every limit.

More API testing bugs

See all 158 bugs