Skip to content
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

Merged
merged 3 commits into from
Apr 18, 2022

Conversation

tzssangglass
Copy link
Member

Description

Fixes # (issue)

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@@ -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}
Copy link
Member

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?

Copy link
Member Author

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}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add

@@ -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)
Copy link
Member

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 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed




=== TEST 19: no username of password
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
=== TEST 19: no username of password
=== TEST 19: no username or password

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants