Skip to content

Allow Roles/Privileges #2379

@orubel

Description

@orubel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions