tzinfo 1.2.9 → 1.2.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ddfbcb761e22870203af94d9cd3d47254ce0487d49ab51d804190d7d1961c125
4
- data.tar.gz: f1e1f7eb70f406974d3fdbcda4cb78a6e2fa0842c0a6ec912fe80986a59e57fa
3
+ metadata.gz: e6364432a0aef34ccf3b6b1ecad65dd6f7f13843ac503cbcea1f693b74c96b46
4
+ data.tar.gz: 825fd6905101f51fa700dfa682490851952de8a692c03954d12f38944f8814c8
5
5
  SHA512:
6
- metadata.gz: 5fe024d4d8c134dc324dedab7e6bca66293cf52e80ca16a3d32222e961dd5b563eead2bd110a72a212e7cde0e8ad0c87bc075ce19ad06e3d46ee0b3c3fb45c0a
7
- data.tar.gz: 2c9c48dd44315d61129850ee160932f64afb1e90d8ca82dcd9388b2a79699c3b140340c9541ef822ba02d0791bc4df7c1c7e5a15c9d5840d37f177c1e5942242
6
+ metadata.gz: ef4b1b6a189bbf011294210d2e0651f41bc82e1db8fe342c9f8dbcefd473e8b49b9affa67bc9a395a5831b376db8d37b5942cfade1dacf5485f23ce3d6f78a46
7
+ data.tar.gz: 2871fbd7aded391c88a74724138073675690710dfca6adbbbe610ec4395e8d6631fad93b22d684650d04d9affeed0ab64a1d7489f766eb9ab1996556329c6ddc
checksums.yaml.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- 3y�=��Q��h�n�;�D7`��Ug�����T���Z�RvP;4P��pQGuI+���Qubd��p۲�oW[��x��q.wyyU�ٽ�a�!2kniƔ9�z
2
- 4�ِ�qjJ�i> f쉾�|���u�#��՞�IO0G4�&|���b�o
3
- A���f���X}�`o��n;>J�iHx�@?���po��׮�CC
1
+ Y�1]Qti�t���mPo���ڊ -O��Dcu���[<��oͽc5}�x`��[^�J?7��s����+��ȶ��Mv��ǐ�� 9e���l9J��ۑ�3?eV~�E����6E����Eb)��xdTk�^�BdAC?�����=Jcr�%�����l�~��)�aPʃ\�=[ݪ��{l��fFBݦ��]_����<vS��0��7�z|�-�$���ؑ����^ڐ��(�ReaK�s�|�c��d
2
+ KW��
data/CHANGES.md CHANGED
@@ -1,3 +1,13 @@
1
+ Version 1.2.10 - 19-Jul-2022
2
+ ----------------------------
3
+
4
+ * Fixed a relative path traversal bug that could cause arbitrary files to be
5
+ loaded with require when used with RubyDataSource. Please refer to
6
+ https://github.com/tzinfo/tzinfo/security/advisories/GHSA-5cm2-9h8c-rvfx for
7
+ details. CVE-2022-31163.
8
+ * Ignore the SECURITY file from Arch Linux's tzdata package. #134.
9
+
10
+
1
11
  Version 1.2.9 - 16-Dec-2020
2
12
  ---------------------------
3
13
 
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2005-2020 Philip Ross
1
+ Copyright (c) 2005-2022 Philip Ross
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of
4
4
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  TZInfo - Ruby Timezone Library
2
2
  ==============================
3
3
 
4
- [![RubyGems](https://img.shields.io/gem/v/tzinfo)](https://rubygems.org/gems/tzinfo) [![Travis CI Build](https://img.shields.io/travis/com/tzinfo/tzinfo/1.2?logo=travis)](https://travis-ci.com/tzinfo/tzinfo) [![AppVeyor Build](https://img.shields.io/appveyor/build/philr/tzinfo/1.2?logo=appveyor)](https://ci.appveyor.com/project/philr/tzinfo/branch/1.2)
4
+ [![RubyGems](https://img.shields.io/gem/v/tzinfo?logo=rubygems&label=Gem)](https://rubygems.org/gems/tzinfo) [![Tests](https://github.com/tzinfo/tzinfo/workflows/Tests/badge.svg?branch=1.2&event=push)](https://github.com/tzinfo/tzinfo/actions?query=workflow%3ATests+branch%3A1.2+event%3Apush)
5
5
 
6
6
  [TZInfo](https://tzinfo.github.io) provides daylight savings aware
7
7
  transformations between times in different timezones.
@@ -38,7 +38,7 @@ module TZInfo
38
38
  # Raises InvalidTimezoneIdentifier if the timezone is not found or the
39
39
  # identifier is invalid.
40
40
  def load_timezone_info(identifier)
41
- raise InvalidTimezoneIdentifier, 'Invalid identifier' if identifier !~ /^[A-Za-z0-9\+\-_]+(\/[A-Za-z0-9\+\-_]+)*$/
41
+ raise InvalidTimezoneIdentifier, 'Invalid identifier' if identifier !~ /\A[A-Za-z0-9+\-_]+(\/[A-Za-z0-9+\-_]+)*\z/
42
42
 
43
43
  identifier = identifier.gsub(/-/, '__m__').gsub(/\+/, '__p__')
44
44
 
@@ -87,6 +87,29 @@ module TZInfo
87
87
  # The default value of ZoneinfoDataSource.alternate_iso3166_tab_search_path.
88
88
  DEFAULT_ALTERNATE_ISO3166_TAB_SEARCH_PATH = ['/usr/share/misc/iso3166.tab', '/usr/share/misc/iso3166'].freeze
89
89
 
90
+ # File and directories in the top level zoneinfo directory that will be
91
+ # excluded from the list of available time zones:
92
+ #
93
+ # - +VERSION is included on Mac OS X.
94
+ # - leapseconds is a list of leap seconds.
95
+ # - localtime is the current local timezone (may be a link).
96
+ # - posix, posixrules and right are directories containing other versions
97
+ # of the zoneinfo files.
98
+ # - SECURITY is included in the Arch Linux tzdata package.
99
+ # - src is a directory containing the tzdata source included on Solaris.
100
+ # - timeconfig is a symlink included on Slackware.
101
+ EXCLUDED_FILENAMES = [
102
+ '+VERSION',
103
+ 'leapseconds',
104
+ 'localtime',
105
+ 'posix',
106
+ 'posixrules',
107
+ 'right',
108
+ 'SECURITY',
109
+ 'src',
110
+ 'timeconfig'
111
+ ].freeze
112
+
90
113
  # Paths to be checked to find the system zoneinfo directory.
91
114
  @@search_path = DEFAULT_SEARCH_PATH.dup
92
115
 
@@ -352,16 +375,8 @@ module TZInfo
352
375
  # identifiers.
353
376
  def load_timezone_index
354
377
  index = []
355
-
356
- # Ignoring particular files:
357
- # +VERSION is included on Mac OS X.
358
- # leapseconds is a list of leap seconds.
359
- # localtime is the current local timezone (may be a link).
360
- # posix, posixrules and right are directories containing other versions of the zoneinfo files.
361
- # src is a directory containing the tzdata source included on Solaris.
362
- # timeconfig is a symlink included on Slackware.
363
-
364
- enum_timezones(nil, ['+VERSION', 'leapseconds', 'localtime', 'posix', 'posixrules', 'right', 'src', 'timeconfig']) do |identifier|
378
+
379
+ enum_timezones(nil, EXCLUDED_FILENAMES) do |identifier|
365
380
  index << identifier
366
381
  end
367
382
 
@@ -0,0 +1 @@
1
+ raise 'This should never be executed'
@@ -48,9 +48,15 @@ class TCRubyDataSource < Minitest::Test
48
48
 
49
49
  def test_load_timezone_info_invalid
50
50
  assert_raises(InvalidTimezoneIdentifier) do
51
- @data_source.load_timezone_info('../Definitions/UTC')
51
+ @data_source.load_timezone_info('../definitions/UTC')
52
52
  end
53
53
  end
54
+
55
+ def test_load_timezone_info_directory_traversal
56
+ test_data_depth = TZINFO_TEST_DATA_DIR.scan('/').size
57
+ payload_path = File.join(TESTS_DIR, 'assets', 'payload')
58
+ assert_raises(InvalidTimezoneIdentifier) { Timezone.get("foo\n#{'/..' * (test_data_depth + 4)}#{payload_path}") }
59
+ end
54
60
 
55
61
  def test_load_timezone_info_nil
56
62
  assert_raises(InvalidTimezoneIdentifier) do
data/test/tc_timezone.rb CHANGED
@@ -213,7 +213,7 @@ class TCTimezone < Minitest::Test
213
213
  end
214
214
 
215
215
  def test_get_invalid
216
- assert_raises(InvalidTimezoneIdentifier) { Timezone.get('../Definitions/UTC') }
216
+ assert_raises(InvalidTimezoneIdentifier) { Timezone.get('../definitions/UTC') }
217
217
  end
218
218
 
219
219
  def test_get_nil
@@ -374,7 +374,7 @@ class TCZoneinfoDataSource < Minitest::Test
374
374
 
375
375
  def test_load_timezone_info_invalid
376
376
  assert_raises(InvalidTimezoneIdentifier) do
377
- @data_source.load_timezone_info('../Definitions/Europe/London')
377
+ @data_source.load_timezone_info('../zoneinfo/Europe/London')
378
378
  end
379
379
  end
380
380
 
@@ -818,6 +818,25 @@ class TCZoneinfoDataSource < Minitest::Test
818
818
  end
819
819
  end
820
820
 
821
+ def test_timezone_identifiers_ignored_security_file
822
+ # The Arch linux tzdata package includes a file named SECURITY giving
823
+ # instructions for reporting security-related bugs.
824
+
825
+ Dir.mktmpdir('tzinfo_test') do |dir|
826
+ FileUtils.touch(File.join(dir, 'zone.tab'))
827
+ FileUtils.touch(File.join(dir, 'iso3166.tab'))
828
+ FileUtils.cp(File.join(@data_source.zoneinfo_dir, 'EST'), File.join(dir, 'EST'))
829
+
830
+ File.open(File.join(dir, 'SECURITY'), 'w') do |f|
831
+ f.binmode
832
+ f.write("Please report any sensitive security-related bugs...\n")
833
+ end
834
+
835
+ data_source = ZoneinfoDataSource.new(dir)
836
+ assert_equal(['EST'], data_source.timezone_identifiers)
837
+ end
838
+ end
839
+
821
840
  def test_load_country_info
822
841
  info = @data_source.load_country_info('GB')
823
842
  assert_equal('GB', info.code)
data/test/test_utils.rb CHANGED
@@ -153,6 +153,22 @@ module Kernel
153
153
 
154
154
  actual_lines = process.readlines
155
155
  actual_lines = actual_lines.collect {|l| l.chomp}
156
+
157
+ # Ignore warnings from JRuby 1.7 and 9.0 on modern versions of Java:
158
+ # https://github.com/tzinfo/tzinfo/runs/1664655982#step:8:1893
159
+ #
160
+ # Ignore untaint deprecation warnings from Bundler 1 on Ruby 3.0.
161
+ actual_lines = actual_lines.reject do |l|
162
+ l.start_with?('unsupported Java version') ||
163
+ l.start_with?('WARNING: An illegal reflective access operation has occurred') ||
164
+ l.start_with?('WARNING: Illegal reflective access by') ||
165
+ l.start_with?('WARNING: Please consider reporting this to the maintainers of') ||
166
+ l.start_with?('WARNING: All illegal access operations will be denied in a future release') ||
167
+ l.start_with?('WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations') ||
168
+ l.start_with?('io/console on JRuby shells out to stty for most operations') ||
169
+ l =~ /\/bundler-1\..*\/lib\/bundler\/.*\.rb:\d+: warning: (Object|Pathname)#untaint is deprecated and will be removed in Ruby 3\.2\.\z/
170
+ end
171
+
156
172
  assert_equal(expected_lines, actual_lines)
157
173
  end
158
174
  end
data/tzinfo.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'tzinfo'
3
- s.version = '1.2.9'
3
+ s.version = '1.2.10'
4
4
  s.summary = 'Daylight savings aware timezone library'
5
5
  s.description = 'TZInfo provides daylight savings aware transformations between times in different time zones.'
6
6
  s.author = 'Philip Ross'
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tzinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.9
4
+ version: 1.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Ross
@@ -29,7 +29,7 @@ cert_chain:
29
29
  J3Zn/kSTjTekiaspyGbczC3PUaeJNxr+yCvR4sk71Xmk/GaKKGOHedJ1uj/LAXrA
30
30
  MR0mpl7b8zCg0PFC1J73uw==
31
31
  -----END CERTIFICATE-----
32
- date: 2020-12-16 00:00:00.000000000 Z
32
+ date: 2022-07-19 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: thread_safe
@@ -92,6 +92,7 @@ files:
92
92
  - lib/tzinfo/zoneinfo_country_info.rb
93
93
  - lib/tzinfo/zoneinfo_data_source.rb
94
94
  - lib/tzinfo/zoneinfo_timezone_info.rb
95
+ - test/assets/payload.rb
95
96
  - test/tc_annual_rules.rb
96
97
  - test/tc_country.rb
97
98
  - test/tc_country_index_definition.rb
@@ -190,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
191
  - !ruby/object:Gem::Version
191
192
  version: '0'
192
193
  requirements: []
193
- rubygems_version: 3.1.4
194
+ rubygems_version: 3.3.7
194
195
  signing_key:
195
196
  specification_version: 4
196
197
  summary: Daylight savings aware timezone library
metadata.gz.sig CHANGED
Binary file