Skip to content

Commit

Permalink
Merge pull request #1504 from temochka/websocket-empty-sessions
Browse files Browse the repository at this point in the history
rack-protection: Don't track the Accept-Language header by default
  • Loading branch information
namusyaka committed Dec 15, 2018
2 parents 5d3099e + 6cf49c8 commit 38e5d63
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
2 changes: 1 addition & 1 deletion rack-protection/lib/rack/protection/session_hijacking.rb
Expand Up @@ -14,7 +14,7 @@ module Protection
class SessionHijacking < Base
default_reaction :drop_session
default_options :tracking_key => :tracking, :encrypt_tracking => true,
:track => %w[HTTP_USER_AGENT HTTP_ACCEPT_LANGUAGE]
:track => %w[HTTP_USER_AGENT]

def accepts?(env)
session = session env
Expand Down
21 changes: 0 additions & 21 deletions rack-protection/spec/lib/rack/protection/session_hijacking_spec.rb
Expand Up @@ -23,27 +23,6 @@
expect(session).not_to be_empty
end

it "denies requests with a changing Accept-Language header" do
session = {:foo => :bar}
get '/', {}, 'rack.session' => session, 'HTTP_ACCEPT_LANGUAGE' => 'a'
get '/', {}, 'rack.session' => session, 'HTTP_ACCEPT_LANGUAGE' => 'b'
expect(session).to be_empty
end

it "accepts requests with the same Accept-Language header" do
session = {:foo => :bar}
get '/', {}, 'rack.session' => session, 'HTTP_ACCEPT_LANGUAGE' => 'a'
get '/', {}, 'rack.session' => session, 'HTTP_ACCEPT_LANGUAGE' => 'a'
expect(session).not_to be_empty
end

it "comparison of Accept-Language header is not case sensitive" do
session = {:foo => :bar}
get '/', {}, 'rack.session' => session, 'HTTP_ACCEPT_LANGUAGE' => 'a'
get '/', {}, 'rack.session' => session, 'HTTP_ACCEPT_LANGUAGE' => 'A'
expect(session).not_to be_empty
end

it "accepts requests with a changing Version header"do
session = {:foo => :bar}
get '/', {}, 'rack.session' => session, 'HTTP_VERSION' => '1.0'
Expand Down

0 comments on commit 38e5d63

Please sign in to comment.