Repository navigation
THREESCALE-11887 Add configurable whitelist_deny_unmatched policy option - #1605
Conversation
df726c7 to
1c1afcc
Compare
|
The current PR shape is unnecessary complicated and confused. For example, if I have type set to Typically, you would only want the policy react on what is being configured, the Arguably, a better assumption might be that if an admin didn't configure a path, there is no explicit rules for the path. With no explicit rules, the policy should ignore paths not matching any scope. So, for this PR, I suggest to add a simple boolean value to the |
1c1afcc to
7b3e856
Compare
Yes, that's a good simplification, the blacklist path is the confusing one. I've updated the policy to use a whitelist specific boolean and ignore it in the blacklist path. |
7b3e856 to
923e5f9
Compare
923e5f9 to
e67a96e
Compare
tkan145
left a comment
There was a problem hiding this comment.
No spec or .t test covers "missing JWT + whitelist_deny_unmatched: false + a request path that matches a configured scope."
a7f18c0 to
46699cf
Compare
Thanks for the review, I've added missing JWT tests to specs for whitelist for combinations of matched/unmatched paths and whitelist_deny_unmatched configurations. |
46699cf to
ac99c87
Compare
- If whitelist policy type: - jwt is not set -> deny - roles match and path match -> deny - roles do not match and no patch matches: - if whitelist_deny_unmatched == true or not set -> deny - if whitelist_deny_unmatched == false -> allow
2cc5b2e to
0565ea2
Compare
Fixes:
Verification:
Deploy 3Scale and Keycloak using the operators.
The default 3Scale configuration comes with API Product and Developer account that has an echo backend mapped to /echo path.
Configure 3Scale OIDC integration for the API Product following the documentation:
https://docs.redhat.com/en/documentation/red_hat_3scale_api_management/2.16/html/administering_the_api_gateway/integrating-threescale-with-an-openid-connect-identity-provider#integrating-threescale-with-rhsso-as-the-openid-connect-identity-provider_oidc
Add new application under Developer account, set client id and client password environment variables:
Verify that the integration is setup correctly:
To test authorized user, add another application and assign a role "my-role" to the corresponding client (this will work with configuration below).
Scenarios tested
Policy created with original version:
{ "name": "keycloak_role_check", "version": "builtin", "configuration": { "scopes": [ { "realm_roles": [], "resource": "/echo/protected", "methods": [ "ANY" ], "client_roles": [ { "client": "{{ jwt.azp }}", "name": "my-role", "name_type": "plain", "client_type": "liquid" } ], "resource_type": "plain" } ], "type": "whitelist" } }With authorized application: 200 response for /echo/protected, 403 for /echo
With not-authorized application: 403 for both
With authorized application: 200 response for both
With not-authorized application: 403 for /echo/protected, 200 response for /echo