#0505
Your RBAC middleware does `policies[user.role][action]` to decide whether a request is allowed.
If an attacker sets their role to `__proto__`, the lookup walks up the prototype chain instead of checking a real policy entry — potentially returning `undefined` or a truthy prototype-inherited value and bypassing the permission check entirely.
Authorization checks are the last line of defence. A single prototype-traversal bug can hand every endpoint to an attacker without any credentials.
checkPermission({role:'__proto__'}, 'read', policies)// throws: 'Invalid role'
checkPermission({role:'user'}, 'read', policies)// returns: true