Skip to content

Commit

Permalink
Do not deserialize GlobalID objects that were not generated by Active…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
rafaelfranca committed Nov 27, 2018
1 parent 0ae59ea commit 6c8eabb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion activejob/lib/active_job/arguments.rb
Expand Up @@ -75,7 +75,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
Expand Down
4 changes: 4 additions & 0 deletions activejob/test/cases/argument_serialization_test.rb
Expand Up @@ -35,6 +35,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 }]
Expand Down

0 comments on commit 6c8eabb

Please sign in to comment.