Open david-woelfle opened 1 year ago
Hi @david-woelfle, Thanks for raising this - we'll take a look and see what we can do on this.
Note for other users. The OIDC is more or less deprecated in favour of the JWT middleware for doing token validation and authZ in OIDC flows. If using the JWT middleware this bug is not present.
Branch/Environment/Version
Describe the bug I use the GW with Keycloak via OIDC and configure the access rights to the APIs via the scope of the JWT (i.e. via 'Roles' that can be configured in Keycloak). While this seems to work generally fine, there seem to exist two error cases where the GW provides access to the target even though no permission where granted in the respective scope.
If the claim does not exist within the JWT payload like this (note that there is no
roles
claim here):If the claim exists within the JWT payload but contains a scope for which no matching policy is defined.
Reproduction steps Steps to reproduce the behavior:
oidc-connect
client. It is necessary to add two Mappers to the client to make this generally work (I can provide more detailes here if required):Audiance
that adds the keycloak client id to theAUD
field of the JWT.User Client Role
that adds the roles in keycloak to theroles
claim of the JWT.oidc-default
policy to effectively block all access not granted by scopes:openid-connect-tester
API even though the user has not the correct roles assigned (case 1 above).role2
in keycloak and assign it to the user. It is still possible to access theopenid-connect-tester
API even though the user has not the correct role (role1
) assigned.Actual behavior GW grants access to target for every user with a valid JWT from keycloak, even though the user has not been granted the permissions as scope (see above).
Expected behavior GW should block access to target for every user that hasn't explicitly granted permissions.
Logs (debug mode or log file): Can be provided if required.
Configuration (tyk config file):