Do not deserialize GlobalID objects that were not generated by Active Job

Trusting any GlobaID object when deserializing jobs can allow
attackers to access information that should not be accessible to them.

Fix CVE-2018-16476.
上级 fc5dd0b8
......@@ -77,7 +77,7 @@ def serialize_argument(argument)
def deserialize_argument(argument)
case argument
when String
GlobalID::Locator.locate(argument) || argument
argument
when *TYPE_WHITELIST
argument
when Array
......
......@@ -37,6 +37,10 @@ class ArgumentSerializationTest < ActiveSupport::TestCase
assert_arguments_roundtrip [@person]
end
test "should keep Global IDs strings as they are" do
assert_arguments_roundtrip [@person.to_gid.to_s]
end
test "should dive deep into arrays and hashes" do
assert_arguments_roundtrip [3, [@person]]
assert_arguments_roundtrip [{ "a" => @person }]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册