1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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.
This commit is contained in:
Rafael Mendonça França 2018-09-05 17:38:09 -04:00
parent ddaca7ccec
commit 72300f9742
2 changed files with 5 additions and 1 deletions

View file

@ -91,7 +91,7 @@ module ActiveJob
def deserialize_argument(argument)
case argument
when String
GlobalID::Locator.locate(argument) || argument
argument
when *PERMITTED_TYPES
argument
when Array

View file

@ -41,6 +41,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 }]