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

Prevent 500 when required parameters are not present #77

Conversation

cincospenguinos
Copy link

@cincospenguinos cincospenguinos commented Jul 16, 2019

Currently, the pre_auth object is getting inspected in authenticate_resource_owner!, before Doorkeeper validates it. If the required OAuth params are not present, it will currently blow up with undefined method application for nil. Our pull request ensures a 401 error is returned rather than a 500 error for this bit.

Solves #78
This appears to be related to #71.

 - the line would fail because no client was available
 - No client was available because no client was included in the params
 - Instead of a 500 error occurring for a request that was malformed, a
   4xx error should be returned instead
 - This fix ensures that such an error is returned

Co-authored-by: Boo Chalhoub <ichalhoub@mavenlink.com>
@cincospenguinos
Copy link
Author

See #79

@@ -8,6 +8,7 @@ def authenticate_resource_owner!
super.tap do |owner|
next unless controller_path == Doorkeeper::Rails::Routes.mapping[:authorizations][:controllers] &&
action_name == 'new'
raise Errors::OpenidConnectError unless pre_auth.valid?
Copy link

Choose a reason for hiding this comment

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

This will still fail on line 37 if we're missing a redirect_uri in our error_response

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.

None yet

2 participants