activesupport 5.2.2 → 5.2.4.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activesupport might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28ba8a573798735113cf64c0bd1ffd7e2bddb6b81be4b9feca484a4543f59c66
4
- data.tar.gz: ca185b08c32e2ce148c0ea786ad508ecd7385878cfe6f442d81115d72dbd4d7b
3
+ metadata.gz: 9eaca090b97477eb47dc519cdd74b4aceb3bc6c9d7f1f9c81b86a5cd000979fc
4
+ data.tar.gz: 1841fae4b6c08dba4845202e96f28096e289da5a2a19fe98cdfb1456361bd72e
5
5
  SHA512:
6
- metadata.gz: ea921839a1a4dcf213a4a057a08e869ec41e557d6602f719537edfd1293cf4115e58e7e3b00133386116197d093ac06c011b903fa69d604abebe92a7c488ea94
7
- data.tar.gz: 017ee32c83d1456e7050c2b4770635375240ce7aa36433edf27a8f525b7b23cf1cc930e19f28b0f77e633b8430b22a5f3a6000a186985ee1fabf72e87c4ad3d5
6
+ metadata.gz: c0d5e35f172cec406ddb9dfec8c552c9d67d20519dab0cc9422f65ecc32c55a4cc750e82cb17ca12e381ade6051b64ba48f30f85165172fc50a9796206cc0a83
7
+ data.tar.gz: b3de3b8b17d0c886ec898dd7c1d1c7585f29e55bbd05186a2eeeb5e96ee43a7b05ba44be337ecc2a0413a37432ecfe7e887c41f06e4a82d1abac5b542472dcf7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,89 @@
1
+ ## Rails 5.2.4.5 (February 10, 2021) ##
2
+
3
+ * No changes.
4
+
5
+
6
+ ## Rails 5.2.4.4 (September 09, 2020) ##
7
+
8
+ * No changes.
9
+
10
+
11
+ ## Rails 5.2.4.3 (May 18, 2020) ##
12
+
13
+ * [CVE-2020-8165] Deprecate Marshal.load on raw cache read in RedisCacheStore
14
+
15
+ * [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
16
+
17
+ ## Rails 5.2.4.1 (December 18, 2019) ##
18
+
19
+ * No changes.
20
+
21
+
22
+ ## Rails 5.2.4 (November 27, 2019) ##
23
+
24
+ * Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
25
+
26
+ Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
27
+ to make log level local to Ruby Fibers in addition to Threads.
28
+
29
+ Example:
30
+
31
+ logger = ActiveSupport::Logger.new(STDOUT)
32
+ logger.level = 1
33
+ p "Main is debug? #{logger.debug?}"
34
+
35
+ Fiber.new {
36
+ logger.local_level = 0
37
+ p "Thread is debug? #{logger.debug?}"
38
+ }.resume
39
+
40
+ p "Main is debug? #{logger.debug?}"
41
+
42
+ Before:
43
+
44
+ Main is debug? false
45
+ Thread is debug? true
46
+ Main is debug? true
47
+
48
+ After:
49
+
50
+ Main is debug? false
51
+ Thread is debug? true
52
+ Main is debug? false
53
+
54
+ *Alexander Varnin*
55
+
56
+
57
+ ## Rails 5.2.3 (March 27, 2019) ##
58
+
59
+ * Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
60
+
61
+ `assoc` can now be called with either a string or a symbol.
62
+
63
+ *Stefan Schüßler*
64
+
65
+ * Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
66
+
67
+ *Keenan Brock*
68
+
69
+ * Allow Range#=== and Range#cover? on Range
70
+
71
+ `Range#cover?` can now accept a range argument like `Range#include?` and
72
+ `Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
73
+ into a new file, with these two methods.
74
+
75
+ *utilum*
76
+
77
+ * If the same block is `included` multiple times for a Concern, an exception is no longer raised.
78
+
79
+ *Mark J. Titorenko*, *Vlad Bokov*
80
+
81
+
82
+ ## Rails 5.2.2.1 (March 11, 2019) ##
83
+
84
+ * No changes.
85
+
86
+
1
87
  ## Rails 5.2.2 (December 04, 2018) ##
2
88
 
3
89
  * Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
@@ -7,7 +7,6 @@ rescue LoadError => e
7
7
  raise e
8
8
  end
9
9
 
10
- require "active_support/core_ext/marshal"
11
10
  require "active_support/core_ext/array/extract_options"
12
11
 
13
12
  module ActiveSupport
@@ -28,14 +27,6 @@ module ActiveSupport
28
27
  # Provide support for raw values in the local cache strategy.
29
28
  module LocalCacheWithRaw # :nodoc:
30
29
  private
31
- def read_entry(key, options)
32
- entry = super
33
- if options[:raw] && local_cache && entry
34
- entry = deserialize_entry(entry.value)
35
- end
36
- entry
37
- end
38
-
39
30
  def write_entry(key, entry, options)
40
31
  if options[:raw] && local_cache
41
32
  raw_entry = Entry.new(entry.value.to_s)
@@ -189,9 +180,8 @@ module ActiveSupport
189
180
  key
190
181
  end
191
182
 
192
- def deserialize_entry(raw_value)
193
- if raw_value
194
- entry = Marshal.load(raw_value) rescue raw_value
183
+ def deserialize_entry(entry)
184
+ if entry
195
185
  entry.is_a?(Entry) ? entry : Entry.new(entry)
196
186
  end
197
187
  end
@@ -70,14 +70,6 @@ module ActiveSupport
70
70
  # Support raw values in the local cache strategy.
71
71
  module LocalCacheWithRaw # :nodoc:
72
72
  private
73
- def read_entry(key, options)
74
- entry = super
75
- if options[:raw] && local_cache && entry
76
- entry = deserialize_entry(entry.value)
77
- end
78
- entry
79
- end
80
-
81
73
  def write_entry(key, entry, options)
82
74
  if options[:raw] && local_cache
83
75
  raw_entry = Entry.new(serialize_entry(entry, raw: true))
@@ -328,7 +320,8 @@ module ActiveSupport
328
320
  # Read an entry from the cache.
329
321
  def read_entry(key, options = nil)
330
322
  failsafe :read_entry do
331
- deserialize_entry redis.with { |c| c.get(key) }
323
+ raw = options&.fetch(:raw, false)
324
+ deserialize_entry(redis.with { |c| c.get(key) }, raw: raw)
332
325
  end
333
326
  end
334
327
 
@@ -343,6 +336,7 @@ module ActiveSupport
343
336
  def read_multi_mget(*names)
344
337
  options = names.extract_options!
345
338
  options = merged_options(options)
339
+ raw = options&.fetch(:raw, false)
346
340
 
347
341
  keys = names.map { |name| normalize_key(name, options) }
348
342
 
@@ -352,7 +346,7 @@ module ActiveSupport
352
346
 
353
347
  names.zip(values).each_with_object({}) do |(name, value), results|
354
348
  if value
355
- entry = deserialize_entry(value)
349
+ entry = deserialize_entry(value, raw: raw)
356
350
  unless entry.nil? || entry.expired? || entry.mismatched?(normalize_version(name, options))
357
351
  results[name] = entry.value
358
352
  end
@@ -421,9 +415,20 @@ module ActiveSupport
421
415
  end
422
416
  end
423
417
 
424
- def deserialize_entry(serialized_entry)
418
+ def deserialize_entry(serialized_entry, raw:)
425
419
  if serialized_entry
426
420
  entry = Marshal.load(serialized_entry) rescue serialized_entry
421
+
422
+ written_raw = serialized_entry.equal?(entry)
423
+ if raw != written_raw
424
+ ActiveSupport::Deprecation.warn(<<-MSG.squish)
425
+ Using a different value for the raw option when reading and writing
426
+ to a cache key is deprecated for :redis_cache_store and Rails 6.0
427
+ will stop automatically detecting the format when reading to avoid
428
+ marshal loading untrusted raw strings.
429
+ MSG
430
+ end
431
+
427
432
  entry.is_a?(Entry) ? entry : Entry.new(entry)
428
433
  end
429
434
  end
@@ -125,9 +125,13 @@ module ActiveSupport
125
125
 
126
126
  def included(base = nil, &block)
127
127
  if base.nil?
128
- raise MultipleIncludedBlocks if instance_variable_defined?(:@_included_block)
129
-
130
- @_included_block = block
128
+ if instance_variable_defined?(:@_included_block)
129
+ if @_included_block.source_location != block.source_location
130
+ raise MultipleIncludedBlocks
131
+ end
132
+ else
133
+ @_included_block = block
134
+ end
131
135
  else
132
136
  super
133
137
  end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/core_ext/digest/uuid"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "active_support/core_ext/range/conversions"
4
- require "active_support/core_ext/range/include_range"
4
+ require "active_support/core_ext/range/compare_range"
5
5
  require "active_support/core_ext/range/include_time_with_zone"
6
6
  require "active_support/core_ext/range/overlaps"
7
7
  require "active_support/core_ext/range/each"
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveSupport
4
+ module CompareWithRange #:nodoc:
5
+ # Extends the default Range#=== to support range comparisons.
6
+ # (1..5) === (1..5) # => true
7
+ # (1..5) === (2..3) # => true
8
+ # (1..5) === (2..6) # => false
9
+ #
10
+ # The native Range#=== behavior is untouched.
11
+ # ('a'..'f') === ('c') # => true
12
+ # (5..9) === (11) # => false
13
+ def ===(value)
14
+ if value.is_a?(::Range)
15
+ # 1...10 includes 1..9 but it does not include 1..10.
16
+ operator = exclude_end? && !value.exclude_end? ? :< : :<=
17
+ super(value.first) && value.last.send(operator, last)
18
+ else
19
+ super
20
+ end
21
+ end
22
+
23
+ # Extends the default Range#include? to support range comparisons.
24
+ # (1..5).include?(1..5) # => true
25
+ # (1..5).include?(2..3) # => true
26
+ # (1..5).include?(2..6) # => false
27
+ #
28
+ # The native Range#include? behavior is untouched.
29
+ # ('a'..'f').include?('c') # => true
30
+ # (5..9).include?(11) # => false
31
+ def include?(value)
32
+ if value.is_a?(::Range)
33
+ # 1...10 includes 1..9 but it does not include 1..10.
34
+ operator = exclude_end? && !value.exclude_end? ? :< : :<=
35
+ super(value.first) && value.last.send(operator, last)
36
+ else
37
+ super
38
+ end
39
+ end
40
+
41
+ # Extends the default Range#cover? to support range comparisons.
42
+ # (1..5).cover?(1..5) # => true
43
+ # (1..5).cover?(2..3) # => true
44
+ # (1..5).cover?(2..6) # => false
45
+ #
46
+ # The native Range#cover? behavior is untouched.
47
+ # ('a'..'f').cover?('c') # => true
48
+ # (5..9).cover?(11) # => false
49
+ def cover?(value)
50
+ if value.is_a?(::Range)
51
+ # 1...10 covers 1..9 but it does not cover 1..10.
52
+ operator = exclude_end? && !value.exclude_end? ? :< : :<=
53
+ super(value.first) && value.last.send(operator, last)
54
+ else
55
+ super
56
+ end
57
+ end
58
+ end
59
+ end
60
+
61
+ Range.prepend(ActiveSupport::CompareWithRange)
@@ -1,25 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module ActiveSupport
4
- module IncludeWithRange #:nodoc:
5
- # Extends the default Range#include? to support range comparisons.
6
- # (1..5).include?(1..5) # => true
7
- # (1..5).include?(2..3) # => true
8
- # (1..5).include?(2..6) # => false
9
- #
10
- # The native Range#include? behavior is untouched.
11
- # ('a'..'f').include?('c') # => true
12
- # (5..9).include?(11) # => false
13
- def include?(value)
14
- if value.is_a?(::Range)
15
- # 1...10 includes 1..9 but it does not include 1..10.
16
- operator = exclude_end? && !value.exclude_end? ? :< : :<=
17
- super(value.first) && value.last.send(operator, last)
18
- else
19
- super
20
- end
21
- end
22
- end
23
- end
24
-
25
- Range.prepend(ActiveSupport::IncludeWithRange)
3
+ require "active_support/core_ext/range/compare_range"
@@ -53,27 +53,37 @@ module ActiveSupport
53
53
  options = method_names.extract_options!
54
54
  deprecator = options.delete(:deprecator) || self
55
55
  method_names += options.keys
56
+ mod = Module.new
56
57
 
57
58
  method_names.each do |method_name|
58
- aliased_method, punctuation = method_name.to_s.sub(/([?!=])$/, ""), $1
59
- with_method = "#{aliased_method}_with_deprecation#{punctuation}"
60
- without_method = "#{aliased_method}_without_deprecation#{punctuation}"
59
+ if target_module.method_defined?(method_name) || target_module.private_method_defined?(method_name)
60
+ aliased_method, punctuation = method_name.to_s.sub(/([?!=])$/, ""), $1
61
+ with_method = "#{aliased_method}_with_deprecation#{punctuation}"
62
+ without_method = "#{aliased_method}_without_deprecation#{punctuation}"
61
63
 
62
- target_module.send(:define_method, with_method) do |*args, &block|
63
- deprecator.deprecation_warning(method_name, options[method_name])
64
- send(without_method, *args, &block)
65
- end
64
+ target_module.send(:define_method, with_method) do |*args, &block|
65
+ deprecator.deprecation_warning(method_name, options[method_name])
66
+ send(without_method, *args, &block)
67
+ end
66
68
 
67
- target_module.send(:alias_method, without_method, method_name)
68
- target_module.send(:alias_method, method_name, with_method)
69
+ target_module.send(:alias_method, without_method, method_name)
70
+ target_module.send(:alias_method, method_name, with_method)
69
71
 
70
- case
71
- when target_module.protected_method_defined?(without_method)
72
- target_module.send(:protected, method_name)
73
- when target_module.private_method_defined?(without_method)
74
- target_module.send(:private, method_name)
72
+ case
73
+ when target_module.protected_method_defined?(without_method)
74
+ target_module.send(:protected, method_name)
75
+ when target_module.private_method_defined?(without_method)
76
+ target_module.send(:private, method_name)
77
+ end
78
+ else
79
+ mod.send(:define_method, method_name) do |*args, &block|
80
+ deprecator.deprecation_warning(method_name, options[method_name])
81
+ super(*args, &block)
82
+ end
75
83
  end
76
84
  end
85
+
86
+ target_module.prepend(mod) unless mod.instance_methods(false).empty?
77
87
  end
78
88
  end
79
89
  end
@@ -9,8 +9,8 @@ module ActiveSupport
9
9
  module VERSION
10
10
  MAJOR = 5
11
11
  MINOR = 2
12
- TINY = 2
13
- PRE = nil
12
+ TINY = 4
13
+ PRE = "5"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -163,6 +163,19 @@ module ActiveSupport
163
163
  super(convert_key(key))
164
164
  end
165
165
 
166
+ # Same as <tt>Hash#assoc</tt> where the key passed as argument can be
167
+ # either a string or a symbol:
168
+ #
169
+ # counters = ActiveSupport::HashWithIndifferentAccess.new
170
+ # counters[:foo] = 1
171
+ #
172
+ # counters.assoc('foo') # => ["foo", 1]
173
+ # counters.assoc(:foo) # => ["foo", 1]
174
+ # counters.assoc(:zoo) # => nil
175
+ def assoc(key)
176
+ super(convert_key(key))
177
+ end
178
+
166
179
  # Same as <tt>Hash#fetch</tt> where the key passed as argument can be
167
180
  # either a string or a symbol:
168
181
  #
@@ -329,6 +329,8 @@ module ActiveSupport
329
329
  e.name.to_s == camel_cased_word.to_s)
330
330
  rescue ArgumentError => e
331
331
  raise unless /not missing constant #{const_regexp(camel_cased_word)}!$/.match?(e.message)
332
+ rescue LoadError => e
333
+ raise unless /Unable to autoload constant #{const_regexp(camel_cased_word)}/.match?(e.message)
332
334
  end
333
335
 
334
336
  # Returns the suffix that should be added to a number to denote the position
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "active_support/concern"
4
+ require "fiber"
4
5
 
5
6
  module ActiveSupport
6
7
  module LoggerThreadSafeLevel # :nodoc:
@@ -11,7 +12,7 @@ module ActiveSupport
11
12
  end
12
13
 
13
14
  def local_log_id
14
- Thread.current.__id__
15
+ Fiber.current.__id__
15
16
  end
16
17
 
17
18
  def local_level
@@ -18,8 +18,8 @@ module ActiveSupport
18
18
  super
19
19
  end
20
20
 
21
- def subscribe(pattern = nil, block = Proc.new)
22
- subscriber = Subscribers.new pattern, block
21
+ def subscribe(pattern = nil, callable = nil, &block)
22
+ subscriber = Subscribers.new(pattern, callable || block)
23
23
  synchronize do
24
24
  @subscribers << subscriber
25
25
  @listeners_for.clear
@@ -39,7 +39,7 @@ module ActiveSupport
39
39
  end
40
40
 
41
41
  def method_missing(name, *args)
42
- name_string = name.to_s
42
+ name_string = name.to_s.dup
43
43
  if name_string.chomp!("=")
44
44
  self[name_string] = args.first
45
45
  else
@@ -75,7 +75,7 @@ module ActiveSupport
75
75
  begin
76
76
  BigDecimal(number)
77
77
  rescue ArgumentError
78
- BigDecimal("0")
78
+ BigDecimal(number.to_f.to_s)
79
79
  end
80
80
  else
81
81
  BigDecimal(number)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.2
4
+ version: 5.2.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-04 00:00:00.000000000 Z
11
+ date: 2021-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -139,6 +139,7 @@ files:
139
139
  - lib/active_support/core_ext/date_time/calculations.rb
140
140
  - lib/active_support/core_ext/date_time/compatibility.rb
141
141
  - lib/active_support/core_ext/date_time/conversions.rb
142
+ - lib/active_support/core_ext/digest.rb
142
143
  - lib/active_support/core_ext/digest/uuid.rb
143
144
  - lib/active_support/core_ext/enumerable.rb
144
145
  - lib/active_support/core_ext/file.rb
@@ -197,6 +198,7 @@ files:
197
198
  - lib/active_support/core_ext/object/try.rb
198
199
  - lib/active_support/core_ext/object/with_options.rb
199
200
  - lib/active_support/core_ext/range.rb
201
+ - lib/active_support/core_ext/range/compare_range.rb
200
202
  - lib/active_support/core_ext/range/conversions.rb
201
203
  - lib/active_support/core_ext/range/each.rb
202
204
  - lib/active_support/core_ext/range/include_range.rb
@@ -331,8 +333,8 @@ homepage: http://rubyonrails.org
331
333
  licenses:
332
334
  - MIT
333
335
  metadata:
334
- source_code_uri: https://github.com/rails/rails/tree/v5.2.2/activesupport
335
- changelog_uri: https://github.com/rails/rails/blob/v5.2.2/activesupport/CHANGELOG.md
336
+ source_code_uri: https://github.com/rails/rails/tree/v5.2.4.5/activesupport
337
+ changelog_uri: https://github.com/rails/rails/blob/v5.2.4.5/activesupport/CHANGELOG.md
336
338
  post_install_message:
337
339
  rdoc_options:
338
340
  - "--encoding"
@@ -350,8 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
350
352
  - !ruby/object:Gem::Version
351
353
  version: '0'
352
354
  requirements: []
353
- rubyforge_project:
354
- rubygems_version: 2.7.6
355
+ rubygems_version: 3.0.3
355
356
  signing_key:
356
357
  specification_version: 4
357
358
  summary: A toolkit of support libraries and Ruby core extensions extracted from the