Repository navigation
Fix valid_response_type? discarding the fail! Rack response - #218
Open
cnorthwood wants to merge 1 commit into
Open
cnorthwood wants to merge 1 commit into
cnorthwood wants to merge 1 commit into
Conversation
valid_response_type? calls fail!, which invokes on_failure and produces a Rack redirect response, but then discards it by returning false. callback_phase then returns nil via 'return unless valid_response_type?', which propagates as a nil Rack response and crashes downstream middleware (e.g. Rack::ContentLength with NoMethodError: undefined method '[]' for nil). Fix by raising the exception instead of calling fail! directly. The exception propagates to the rescue StandardError in OmniAuth::Strategy#call!, which calls fail! and properly returns the redirect response to the client. Fixes omniauth#217
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
valid_response_type?callsfail!, which invokeson_failureand produces a Rack redirect response, but then discards it by returningfalse:callback_phasethen doesreturn unless valid_response_type?, which returnsnil. This propagates as a nil Rack response and crashes downstream middleware:This is triggered when the OAuth provider returns an error response (e.g.
?error=access_denied) without acodeparam. Related to #105.Fix
Raise the exception instead of calling
fail!directly. The exception propagates to therescue StandardErrorinOmniAuth::Strategy#call!, which callsfail!and properly returns the redirect response to the client.Fixes #217