Skip to content

Commit db37fe2

Browse files
authored
Merge pull request #53 from RadiusNetworks/cover6/open-redirect-issue
Ignore anything that isn't a URI path when returning
2 parents 85b51fe + 701cb2d commit db37fe2

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

app/controllers/kracken/sessions_controller.rb

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# frozen_string_literal: true
22

33
module Kracken
4-
class SessionsController < ActionController::Base
4+
class SessionsController < ActionController::Base # rubocop:disable Rails/ApplicationController
55
protect_from_forgery with: :exception
66

7-
def create
7+
def create # rubocop:disable Metrics/AbcSize
88
@user = user_class.find_or_create_from_auth_hash(auth_hash)
99
session[:user_id] = @user.id
1010
session[:user_uid] = @user.uid
@@ -24,10 +24,12 @@ def failure
2424
render text: "Sorry, but you didn't allow access to our app!"
2525
end
2626

27-
protected
27+
protected
2828

2929
def return_to_path
30-
request.env['omniauth.origin'] || "/"
30+
return "/" unless request.env['omniauth.origin'].starts_with?('/')
31+
32+
request.env['omniauth.origin']
3133
end
3234

3335
def auth_hash

lib/kracken/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module Kracken
4-
VERSION = "0.4.3"
4+
VERSION = "0.4.4"
55
end

0 commit comments

Comments
 (0)