Skip to content

Commit d576b7a

Browse files
committed
Fix possible deserialization of untrusted data
There is a deserialization of untrusted data vulnerability in the Kredis JSON deserialization code. This vulnerability has been assigned the CVE identifier CVE-2023-27531. Carefully crafted JSON data processed by Kredis may result in deserialization of untrusted data, potentially leading to deserialization of unexpected objects in the system. Any applications using Kredis with JSON are affected.
1 parent 1c2e3a6 commit d576b7a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/kredis/type/json.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def type
88
end
99

1010
def cast_value(value)
11-
JSON.load(value)
11+
JSON.parse(value)
1212
end
1313

1414
def serialize(value)

test/types/scalar_test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ class ScalarTest < ActiveSupport::TestCase
6060
json = Kredis.json "myscalar"
6161
json.value = { "one" => 1, "string" => "hello" }
6262
assert_equal({ "one" => 1, "string" => "hello" }, json.value)
63+
64+
json.value = {"json_class"=>"String", "raw"=>[97, 98, 99]}
65+
assert_equal({"json_class"=>"String", "raw"=>[97, 98, 99]}, json.value)
6366
end
6467

6568
test "invalid type" do

0 commit comments

Comments
 (0)