diff options
author | Matthew Draper <matthew@trebex.net> | 2018-08-29 14:07:37 +0930 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-29 14:07:37 +0930 |
commit | 068fe7dc9045856b822833db5cb7cb690e6000d7 (patch) | |
tree | e9c6ce3a42e29e09bb899b6e4c7e695d97b3c428 /activejob/lib | |
parent | 28e5085070f95f32a6a909cce6d77fd460c73885 (diff) | |
parent | 7c9751d7fe3aec1e67004d1bb5e4a1702fcacafb (diff) | |
download | rails-068fe7dc9045856b822833db5cb7cb690e6000d7.tar.gz rails-068fe7dc9045856b822833db5cb7cb690e6000d7.tar.bz2 rails-068fe7dc9045856b822833db5cb7cb690e6000d7.zip |
Merge pull request #33718 from kddeisz/permit-list
Finish converting whitelist and blacklist references
Diffstat (limited to 'activejob/lib')
-rw-r--r-- | activejob/lib/active_job/arguments.rb | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/activejob/lib/active_job/arguments.rb b/activejob/lib/active_job/arguments.rb index 86bb0c5540..ba7f9456f9 100644 --- a/activejob/lib/active_job/arguments.rb +++ b/activejob/lib/active_job/arguments.rb @@ -24,18 +24,20 @@ module ActiveJob module Arguments extend self # :nodoc: - TYPE_WHITELIST = [ NilClass, String, Integer, Float, BigDecimal, TrueClass, FalseClass ] + PERMITTED_TYPES = [ NilClass, String, Integer, Float, BigDecimal, TrueClass, FalseClass ] - # Serializes a set of arguments. Whitelisted types are returned - # as-is. Arrays/Hashes are serialized element by element. - # All other types are serialized using GlobalID. + # Serializes a set of arguments. Intrinsic types that can safely be + # serialized without mutation are returned as-is. Arrays/Hashes are + # serialized element by element. All other types are serialized using + # GlobalID. def serialize(arguments) arguments.map { |argument| serialize_argument(argument) } end - # Deserializes a set of arguments. Whitelisted types are returned - # as-is. Arrays/Hashes are deserialized element by element. - # All other types are deserialized using GlobalID. + # Deserializes a set of arguments. Instrinsic types that can safely be + # deserialized without mutation are returned as-is. Arrays/Hashes are + # deserialized element by element. All other types are deserialized using + # GlobalID. def deserialize(arguments) arguments.map { |argument| deserialize_argument(argument) } rescue @@ -64,7 +66,7 @@ module ActiveJob def serialize_argument(argument) case argument - when *TYPE_WHITELIST + when *PERMITTED_TYPES argument when GlobalID::Identification convert_to_global_id_hash(argument) @@ -88,7 +90,7 @@ module ActiveJob case argument when String GlobalID::Locator.locate(argument) || argument - when *TYPE_WHITELIST + when *PERMITTED_TYPES argument when Array argument.map { |arg| deserialize_argument(arg) } |