Skip to content

Commit 72300f9

Browse files
committed
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.
1 parent ddaca7c commit 72300f9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

activejob/lib/active_job/arguments.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def serialize_argument(argument)
9191
def deserialize_argument(argument)
9292
case argument
9393
when String
94-
GlobalID::Locator.locate(argument) || argument
94+
argument
9595
when *PERMITTED_TYPES
9696
argument
9797
when Array

activejob/test/cases/argument_serialization_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ class ArgumentSerializationTest < ActiveSupport::TestCase
4141
assert_arguments_roundtrip [@person]
4242
end
4343

44+
test "should keep Global IDs strings as they are" do
45+
assert_arguments_roundtrip [@person.to_gid.to_s]
46+
end
47+
4448
test "should dive deep into arrays and hashes" do
4549
assert_arguments_roundtrip [3, [@person]]
4650
assert_arguments_roundtrip [{ "a" => @person }]

0 commit comments

Comments
 (0)