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(oauth2) send 400 on invalid scope string #3206

Closed
wants to merge 1 commit into from

Conversation

Gman98ish
Copy link
Contributor

@Gman98ish Gman98ish commented Feb 8, 2018

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

  • return 400 when an invalid scope string is given

Issues resolved

Fix #3205

@Gman98ish Gman98ish force-pushed the master branch 3 times, most recently from 78c0741 to 2a72266 Compare February 8, 2018 15:00
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
Copy link
Member

@bungle bungle left a comment

Choose a reason for hiding this comment

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

LGTM!

@bungle bungle added pr/ready This PR is considered ready and can be merged at anytime (given it received no subsequent changes) and removed pr/please review labels Mar 19, 2018
@@ -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"}
Copy link
Member

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 :)

Copy link
Member

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

thibaultcha pushed a commit that referenced this pull request Mar 28, 2018
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>
@thibaultcha
Copy link
Member

Manually merged with minor edits, thank you for the patch!

kikito pushed a commit to kikito/kong that referenced this pull request Apr 10, 2018
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/ready This PR is considered ready and can be merged at anytime (given it received no subsequent changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

invalid scope string returns 500
3 participants