utopia 2.5.3 → 2.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e4f7ed0e917892a978b87d88b3ed57ef0e2c931121f3a45da37dba7be0f0907
4
- data.tar.gz: b20c0f964a4f9ddc7695b76c8bc608b06bf7aa5eb5127abff8c81c2e2aa68386
3
+ metadata.gz: 8fef52d1f6de5c2a8e44763e7f6e7b59869e8a678627b3331876c788a8d1d5c2
4
+ data.tar.gz: 0b89a96822bb9601711c411fd61eeaaf31821f79ec97d15653d8f6f113d0662d
5
5
  SHA512:
6
- metadata.gz: 0b79dce92c2c6bc7465eed78dee533eaf3ca9569a0b041e8681e53bc46a239b922a3dc86470b55d61cd4f55c0fd1f28dbdf674f5ba4f6764690371516f044f95
7
- data.tar.gz: cf229b496e85607701adbed264ca9c8db098da0a5cda247ace80960b4c58a239e37b3e6a997660a1ad9b8fdbca97c3b5fa9979353994fcdeaa3a6c73d3cc67e9
6
+ metadata.gz: 656d6a39c064ec5078e8ef16782a013491bcb14b33f8102d4ed0db7e6205152d4bbb25ff0d58afdf328f14c41e43d7dad1234aab68ab2f8a0f483f22ee40fddb
7
+ data.tar.gz: fbb4f8d06aa9181fc06523b2dc0f67872400f7d868ed1f05e6f73d9a07462b6563695613258239352efdbcd83ae3ca7b04cd555eb24f39b2c956c08d3ce89eef
@@ -42,7 +42,7 @@ module Utopia
42
42
  # @param secret [Array] The secret text used to generate a symetric encryption key for the coookie data.
43
43
  # @param expires_after [String] The cache-control header to set for static content.
44
44
  # @param options [Hash<Symbol,Object>] Additional defaults used for generating the cookie by `Rack::Utils.set_cookie_header!`.
45
- def initialize(app, session_name: RACK_SESSION, secret: nil, expires_after: DEFAULT_EXPIRES_AFTER, update_timeout: DEFAULT_UPDATE_TIMEOUT, **options)
45
+ def initialize(app, session_name: RACK_SESSION, secret: nil, expires_after: DEFAULT_EXPIRES_AFTER, update_timeout: DEFAULT_UPDATE_TIMEOUT, secure: false, **options)
46
46
  @app = app
47
47
 
48
48
  @session_name = session_name
@@ -63,7 +63,7 @@ module Utopia
63
63
  domain: nil,
64
64
  path: "/",
65
65
  # The Secure attribute is meant to keep cookie communication limited to encrypted transmission, directing browsers to use cookies only via secure/encrypted connections. However, if a web server sets a cookie with a secure attribute from a non-secure connection, the cookie can still be intercepted when it is sent to the user by man-in-the-middle attacks. Therefore, for maximum security, cookies with the Secure attribute should only be set over a secure connection.
66
- secure: false,
66
+ secure: secure,
67
67
  # The HttpOnly attribute directs browsers not to expose cookies through channels other than HTTP (and HTTPS) requests. This means that the cookie cannot be accessed via client-side scripting languages (notably JavaScript), and therefore cannot be stolen easily via cross-site scripting (a pervasive attack technique).
68
68
  http_only: true,
69
69
  }.merge(options)
@@ -122,8 +122,7 @@ module Utopia
122
122
  # Constructs a valid session for the given request. These fields must match as per the checks performed in `valid_session?`:
123
123
  def build_initial_session(request)
124
124
  {
125
- request_ip: request.ip,
126
- request_user_agent: request.user_agent,
125
+ user_agent: request.user_agent,
127
126
  created_at: Time.now.utc,
128
127
  updated_at: Time.now.utc,
129
128
  }
@@ -146,14 +145,8 @@ module Utopia
146
145
  end
147
146
 
148
147
  def valid_session?(request, values)
149
- if values[:request_ip] != request.ip
150
- warn "Invalid session because #{values[:request_ip]} doesn't match #{request.ip}!"
151
-
152
- return false
153
- end
154
-
155
- if values[:request_user_agent] != request.user_agent
156
- warn "Invalid session because #{values[:request_user_agent]} doesn't match #{request.user_agent}!"
148
+ if values[:user_agent] != request.user_agent
149
+ warn "Invalid session because #{values[:user_agent]} doesn't match #{request.user_agent}!" if $VERBOSE
157
150
 
158
151
  return false
159
152
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Utopia
22
- VERSION = "2.5.3"
22
+ VERSION = "2.5.4"
23
23
  end
@@ -103,12 +103,12 @@ module Utopia::SessionSpec
103
103
  expect(last_response.body).to be == ""
104
104
  end
105
105
 
106
- it "should fail if ip address is changed" do
106
+ it "shouldn't fail if ip address is changed" do
107
107
  # Change user agent:
108
108
  header 'X-Forwarded-For', '127.0.0.10'
109
109
 
110
110
  get "/session-get?key=foo"
111
- expect(last_response.body).to be == ""
111
+ expect(last_response.body).to be == "bar"
112
112
  end
113
113
  end
114
114
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utopia
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.3
4
+ version: 2.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-31 00:00:00.000000000 Z
11
+ date: 2018-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trenni