-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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(oauth2) send 400 on invalid scope string #3206
Conversation
78c0741
to
2a72266
Compare
If you create an oauth2 token, and pass something other than a string, you get a 500 error. This updates the retrieve_scopes method to perform a type check and return a 400 if it isn't a string * return 400 when an invalid scope string is given
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.
LGTM!
@@ -116,6 +116,11 @@ end | |||
local function retrieve_scopes(parameters, conf) | |||
local scope = parameters[SCOPE] | |||
local scopes = {} | |||
|
|||
if scope and type(scope) ~= "string" then | |||
return false, {[ERROR] = "invalid_scope", error_description = "scope must be a string"} |
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.
style: we use 2 spaces indentation across this codebase :)
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.
we should also probably move this branch under the below one
If you create an oauth2 token and pass something other than a string, you get a 500 error. This updates the retrieve_scopes method to perform a type check and return HTTP 400 if it isn't a string. * return 400 when an invalid scope type is given Fix #3205 From #3206 Signed-off-by: Thibault Charbonnier <thibaultcha@me.com>
Manually merged with minor edits, thank you for the patch! |
If you create an oauth2 token and pass something other than a string, you get a 500 error. This updates the retrieve_scopes method to perform a type check and return HTTP 400 if it isn't a string. * return 400 when an invalid scope type is given Fix Kong#3205 From Kong#3206 Signed-off-by: Thibault Charbonnier <thibaultcha@me.com>
Summary
If you create an oauth2 token, and pass a scope as something other than a
string, you get a 500 error. This updates the retrieve_scopes
method to perform a type check and return a 400 if it isn't a
string
Full changelog
Issues resolved
Fix #3205