-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(authz-keycloak): do not expose internal errors to the client #6854
Conversation
@@ -722,12 +722,12 @@ local function generate_token_using_password_grant(conf,ctx) | |||
if not username then | |||
local err = "username is missing." | |||
log.error(err) | |||
return 422, err | |||
return 422, {message = err} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to add test to cover this branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add
end | ||
if not password then | ||
local err = "password is missing." | ||
log.error(err) | ||
return 422, err | ||
return 422, {message = err} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add
apisix/plugins/authz-keycloak.lua
Outdated
@@ -722,12 +722,12 @@ local function generate_token_using_password_grant(conf,ctx) | |||
if not username then | |||
local err = "username is missing." | |||
log.error(err) | |||
return 422, err | |||
return 422, {message = err} | |||
end | |||
if not password then | |||
local err = "password is missing." | |||
log.error(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we use log level warn
instead of error
level with 4xx
status code ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
t/plugin/authz-keycloak.t
Outdated
|
||
|
||
|
||
=== TEST 19: no username of password |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=== TEST 19: no username of password | |
=== TEST 19: no username or password |
Description
Fixes # (issue)
Checklist