gds-sso 23.0.0 → 23.1.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/limit_session_data.rb +3 -1
- data/lib/gds-sso/version.rb +1 -1
- data/spec/request/limit_session_data_spec.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a95e61408af0e4dcc151b31d6ec2cba9bd0099b3ed13e8d6c11fabed4a597528
|
|
4
|
+
data.tar.gz: 18a6a4441629042f3c0eb026419a6af2294870e7a378b073b3335e9ad31bef07
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a78f8c4696ac1da20f32f6ee080efea0d46ff43461d6d41c1bce21a6172c0080d444778439d1ecf97cc3823f6ded0c9466bf7999de315f4ac9d220fda50425ad
|
|
7
|
+
data.tar.gz: 39657e8cff0191f9e03d1cc949810031ab5aca512bc5cfd1a00899fca7d84ccf09782d5987d712de2ab5b623e57d26b8ab40897197008d979460c387ed81f126
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require "active_support/json"
|
|
2
|
+
|
|
1
3
|
module GDS
|
|
2
4
|
module SSO
|
|
3
5
|
class LimitSessionData
|
|
@@ -33,7 +35,7 @@ module GDS
|
|
|
33
35
|
end
|
|
34
36
|
|
|
35
37
|
def serialized_bytesize(value)
|
|
36
|
-
JSON.
|
|
38
|
+
ActiveSupport::JSON.encode(value).bytesize
|
|
37
39
|
rescue StandardError
|
|
38
40
|
# If we can't serialise it to measure it, assume it's too large
|
|
39
41
|
Float::INFINITY
|
data/lib/gds-sso/version.rb
CHANGED
|
@@ -32,6 +32,13 @@ RSpec.describe "GDS-SSO session data limitation", type: :request do
|
|
|
32
32
|
expect(response).to have_http_status(:bad_request)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
+
it "responds with 400 when HTML-escapable characters inflate the serialised cookie size" do
|
|
36
|
+
# ActiveSupport::JSON escapes '&' to \u0026 (6 bytes); JSON.generate doesn't
|
|
37
|
+
get "/auth/gds", headers: { "HTTP_REFERER" => "https://example.com/p?#{'bbb&' * 230}" }
|
|
38
|
+
|
|
39
|
+
expect(response).to have_http_status(:bad_request)
|
|
40
|
+
end
|
|
41
|
+
|
|
35
42
|
it "does not write the oversized data into the session cookie" do
|
|
36
43
|
get "/auth/gds?payload=#{'A' * 6000}"
|
|
37
44
|
|