activesupport 5.2.4.1 → 5.2.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: 63ec42059f6cf3bef91cddb9342a4c0aa51761a2553f932919e283a6a1e70a19
4
- data.tar.gz: 34241f0f3751d1381cb22f792290528cc809530f3aade8937d0e6a60b14654f1
3
+ metadata.gz: 7e0fa29c7295e4a4402a7e6c2db46a0179f35b3b68125888a6cc191b186af251
4
+ data.tar.gz: b1683c3540effb16dd44128bb9f0986388f21ff777e0b3a44eae779160aaf45f
5
5
  SHA512:
6
- metadata.gz: fc8171b6755b13497efdb76430c925b66bdd16ea4440ac2a3625e03655aa63394aad91a4bddcfee030bfd6d2a130bfc31654b6c08fcf0ba4f8b541a29627a74c
7
- data.tar.gz: c0021f8f84d535d8aad50c3561a959c3ba4485a4a6bcd0dfeeb92fb316369b6db49e10c8c7ef4f616efe75d17748194bd1ccb96e8870aefc2f4f167b82048110
6
+ metadata.gz: 6b323c40a81203c83c422534df283d010d1f544787277cf914008353a8c5437dfba3b688176512a197af31df312c5a0e56f06b7fa19578ba4ff78189fd05041b
7
+ data.tar.gz: 3ad31799a6a8f24dabac77889a5d0b5e2c6f4fe818426abe4aa98a26a307159cf79ff03eb44af5bf3ea84efd7c6604fbe2240366c98cc3f0575fc7fe628132f4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ ## Rails 5.2.5 (March 26, 2021) ##
2
+
3
+ * No changes.
4
+
5
+
6
+ ## Rails 5.2.4.5 (February 10, 2021) ##
7
+
8
+ * No changes.
9
+
10
+
11
+ ## Rails 5.2.4.4 (September 09, 2020) ##
12
+
13
+ * No changes.
14
+
15
+
16
+ ## Rails 5.2.4.3 (May 18, 2020) ##
17
+
18
+ * [CVE-2020-8165] Deprecate Marshal.load on raw cache read in RedisCacheStore
19
+
20
+ * [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
21
+
22
+ ## Rails 5.2.4.2 (March 19, 2020) ##
23
+
24
+ * No changes.
25
+
26
+
1
27
  ## Rails 5.2.4.1 (December 18, 2019) ##
2
28
 
3
29
  * No changes.
@@ -28,14 +28,6 @@ module ActiveSupport
28
28
  # Provide support for raw values in the local cache strategy.
29
29
  module LocalCacheWithRaw # :nodoc:
30
30
  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
31
  def write_entry(key, entry, options)
40
32
  if options[:raw] && local_cache
41
33
  raw_entry = Entry.new(entry.value.to_s)
@@ -189,9 +181,8 @@ module ActiveSupport
189
181
  key
190
182
  end
191
183
 
192
- def deserialize_entry(raw_value)
193
- if raw_value
194
- entry = Marshal.load(raw_value) rescue raw_value
184
+ def deserialize_entry(entry)
185
+ if entry
195
186
  entry.is_a?(Entry) ? entry : Entry.new(entry)
196
187
  end
197
188
  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 && 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 && 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
@@ -183,15 +183,15 @@ module ActiveSupport
183
183
  #
184
184
  def build(value)
185
185
  parts = {}
186
- remainder = value.to_f
186
+ remainder = value.round(9)
187
187
 
188
188
  PARTS.each do |part|
189
189
  unless part == :seconds
190
190
  part_in_seconds = PARTS_IN_SECONDS[part]
191
191
  parts[part] = remainder.div(part_in_seconds)
192
- remainder = (remainder % part_in_seconds).round(9)
192
+ remainder %= part_in_seconds
193
193
  end
194
- end
194
+ end unless value == 0
195
195
 
196
196
  parts[:seconds] = remainder
197
197
 
@@ -210,7 +210,7 @@ module ActiveSupport
210
210
  def initialize(value, parts) #:nodoc:
211
211
  @value, @parts = value, parts.to_h
212
212
  @parts.default = 0
213
- @parts.reject! { |k, v| v.zero? }
213
+ @parts.reject! { |k, v| v.zero? } unless value == 0
214
214
  end
215
215
 
216
216
  def coerce(other) #:nodoc:
@@ -400,8 +400,14 @@ module ActiveSupport
400
400
  private
401
401
 
402
402
  def sum(sign, time = ::Time.current)
403
- parts.inject(time) do |t, (type, number)|
404
- if t.acts_like?(:time) || t.acts_like?(:date)
403
+ unless time.acts_like?(:time) || time.acts_like?(:date)
404
+ raise ::ArgumentError, "expected a time or date, got #{time.inspect}"
405
+ end
406
+
407
+ if parts.empty?
408
+ time.since(sign * value)
409
+ else
410
+ parts.inject(time) do |t, (type, number)|
405
411
  if type == :seconds
406
412
  t.since(sign * number)
407
413
  elsif type == :minutes
@@ -411,8 +417,6 @@ module ActiveSupport
411
417
  else
412
418
  t.advance(type => sign * number)
413
419
  end
414
- else
415
- raise ::ArgumentError, "expected a time or date, got #{time.inspect}"
416
420
  end
417
421
  end
418
422
  end
@@ -9,8 +9,8 @@ module ActiveSupport
9
9
  module VERSION
10
10
  MAJOR = 5
11
11
  MINOR = 2
12
- TINY = 4
13
- PRE = "1"
12
+ TINY = 5
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
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.4.1
4
+ version: 5.2.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: 2019-12-18 00:00:00.000000000 Z
11
+ date: 2021-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -333,8 +333,8 @@ homepage: http://rubyonrails.org
333
333
  licenses:
334
334
  - MIT
335
335
  metadata:
336
- source_code_uri: https://github.com/rails/rails/tree/v5.2.4.1/activesupport
337
- changelog_uri: https://github.com/rails/rails/blob/v5.2.4.1/activesupport/CHANGELOG.md
336
+ source_code_uri: https://github.com/rails/rails/tree/v5.2.5/activesupport
337
+ changelog_uri: https://github.com/rails/rails/blob/v5.2.5/activesupport/CHANGELOG.md
338
338
  post_install_message:
339
339
  rdoc_options:
340
340
  - "--encoding"
@@ -352,7 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
352
352
  - !ruby/object:Gem::Version
353
353
  version: '0'
354
354
  requirements: []
355
- rubygems_version: 3.0.3
355
+ rubygems_version: 3.1.2
356
356
  signing_key:
357
357
  specification_version: 4
358
358
  summary: A toolkit of support libraries and Ruby core extensions extracted from the