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:
parent
ddaca7ccec
commit
72300f9742
2 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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 }]
|
||||
|
|
Loading…
Reference in a new issue