-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Description
See issue #1411
So this has been brought up several times, this is now an #owasp #api #security #top10 issue, this was bropught up at DEFCON.
The issue is simple:
If Sally if COMPANYA has multiple ROLES, there has to be a way in OpenAPI to handle request/response data per endpoint by ROLE.
The token will send both ROLES and you will check based upon ROLE WITH HIGHEST PRIVILEGE to determine what to REQUEST and what to return in RESPONSE.
You have NO WAY TO DO THIS. Same with API DOCS in SWAGGER
SWAGGER will show one set of request/response data REGARDLESS OF ROLE.
This creates excessive traffic, shows people endpoints that they do not have access to and potentially the wrong data per their roles.
Their is an ARCHITECTURAL SOLUTION where you can through separate machines at each separate role but this is expensive and wasteful (processor/hr wise) especially when one can declare request/response data PER ROLE :
"create": {
...,
"REQUEST": {
"permitAll":["firstName","oauthProvider","username","accountLocked","password","lastName","oauthId","avatarUrl","email"],
"ROLE_ADMIN": ["passwordExpired","accountExpired","enabled"]
},
"RESPONSE": {
"permitAll":["id"],
"ROLE_ADMIN": ["version","passwordExpired","accountExpired","enabled"]
}
},
...with the 'permitAll concatenated upon everything in 'ROLE' but being a catchall for non-listed roles.
I do this currently and this allows me to 👍
- synchronize on-the-fly between all services (using webhooks from central server)
- have apidocs and apis all be based upon users roles at all times.
- have data be accurate per request/response and in compliance with the OWASP security