gds-sso 21.1.0 → 22.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gds-sso/failure_app.rb +8 -1
- data/lib/gds-sso/version.rb +1 -1
- data/spec/unit/failure_app_spec.rb +31 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc434aa156074fb389c79d10a05993a5493d692a06af85e7d1409b6329ad296e
|
4
|
+
data.tar.gz: 2a4625eae41416c741ed0c0288eb7f4f4d4cb19d78338e5e967ea2761149e6f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35c3637ecf9de2b951b2367924f4b4aff1538a84e2ba0c318ef79dc95eccdd075d9f1c176feaed71dc60a03f8b2d6891bcf08148d85571cfadff303ccaf904ae
|
7
|
+
data.tar.gz: f9c2193558be493ce2f58414c72cb9ec240f835e2e3d5005cfa271716d9b504bbfbba080e487443b4905071209876acd5886f0280ce83630305ae1d2d254d7ae
|
data/lib/gds-sso/failure_app.rb
CHANGED
@@ -6,6 +6,8 @@ require "rails"
|
|
6
6
|
module GDS
|
7
7
|
module SSO
|
8
8
|
class FailureApp < ActionController::Metal
|
9
|
+
MAX_RETURN_TO_PATH_SIZE = 2048
|
10
|
+
|
9
11
|
include ActionController::Redirecting
|
10
12
|
include AbstractController::Rendering
|
11
13
|
include ActionController::Rendering
|
@@ -44,7 +46,12 @@ module GDS
|
|
44
46
|
|
45
47
|
# TOTALLY NOT DOING THE SCOPE THING. PROBABLY SHOULD.
|
46
48
|
def store_location!
|
47
|
-
|
49
|
+
return unless request.get?
|
50
|
+
|
51
|
+
attempted_path = request.env["warden.options"][:attempted_path]
|
52
|
+
return if attempted_path.bytesize > MAX_RETURN_TO_PATH_SIZE
|
53
|
+
|
54
|
+
session["return_to"] = attempted_path
|
48
55
|
end
|
49
56
|
|
50
57
|
private
|
data/lib/gds-sso/version.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe GDS::SSO::FailureApp, type: :request do
|
4
|
+
describe "#redirect" do
|
5
|
+
before do
|
6
|
+
Rails.application.routes.draw do
|
7
|
+
get "redirect", to: GDS::SSO::FailureApp.action(:redirect)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
after { Rails.application.reload_routes! }
|
12
|
+
|
13
|
+
it "should store the return_to path in session when it is reasonably short" do
|
14
|
+
attempted_path = "some-reasonably-short-path"
|
15
|
+
|
16
|
+
get "/redirect", env: { "warden.options" => { attempted_path: } }
|
17
|
+
|
18
|
+
expect(response).to redirect_to("/auth/gds")
|
19
|
+
expect(session["return_to"]).to eq(attempted_path)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should not attempt to store the return_to path in session when it is very long" do
|
23
|
+
attempted_path = "some-#{'very-' * 1000}-long-path"
|
24
|
+
|
25
|
+
get "/redirect", env: { "warden.options" => { attempted_path: } }
|
26
|
+
|
27
|
+
expect(response).to redirect_to("/auth/gds")
|
28
|
+
expect(session["return_to"]).to be_nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds-sso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 22.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
@@ -169,28 +169,28 @@ dependencies:
|
|
169
169
|
requirements:
|
170
170
|
- - "~>"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: '
|
172
|
+
version: '8'
|
173
173
|
type: :development
|
174
174
|
prerelease: false
|
175
175
|
version_requirements: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
177
|
- - "~>"
|
178
178
|
- !ruby/object:Gem::Version
|
179
|
-
version: '
|
179
|
+
version: '8'
|
180
180
|
- !ruby/object:Gem::Dependency
|
181
181
|
name: rubocop-govuk
|
182
182
|
requirement: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
184
|
- - '='
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
version: 5.1.
|
186
|
+
version: 5.1.19
|
187
187
|
type: :development
|
188
188
|
prerelease: false
|
189
189
|
version_requirements: !ruby/object:Gem::Requirement
|
190
190
|
requirements:
|
191
191
|
- - '='
|
192
192
|
- !ruby/object:Gem::Version
|
193
|
-
version: 5.1.
|
193
|
+
version: 5.1.19
|
194
194
|
- !ruby/object:Gem::Dependency
|
195
195
|
name: sqlite3
|
196
196
|
requirement: !ruby/object:Gem::Requirement
|
@@ -272,6 +272,7 @@ files:
|
|
272
272
|
- spec/unit/bearer_token_spec.rb
|
273
273
|
- spec/unit/config_spec.rb
|
274
274
|
- spec/unit/controller_methods_spec.rb
|
275
|
+
- spec/unit/failure_app_spec.rb
|
275
276
|
- spec/unit/gds_sso_spec.rb
|
276
277
|
- spec/unit/mock_bearer_token_spec.rb
|
277
278
|
- spec/unit/railtie_spec.rb
|
@@ -321,6 +322,7 @@ test_files:
|
|
321
322
|
- spec/unit/bearer_token_spec.rb
|
322
323
|
- spec/unit/config_spec.rb
|
323
324
|
- spec/unit/controller_methods_spec.rb
|
325
|
+
- spec/unit/failure_app_spec.rb
|
324
326
|
- spec/unit/gds_sso_spec.rb
|
325
327
|
- spec/unit/mock_bearer_token_spec.rb
|
326
328
|
- spec/unit/railtie_spec.rb
|