🚨 [security] Update tzinfo: 1.2.7 → 1.2.10 (patch)
Welcome to Depfu
This is one of the first three pull requests with dependency updates we've sent your way. We tried to start with a few easy patch-level updates. Hopefully your tests will pass and you can merge this pull request without too much risk. This should give you an idea how Depfu works in general.
After you merge your first pull request, we'll send you a few more. We'll never open more than seven PRs at the same time so you're not getting overwhelmed with updates.
Let us know if you have any questions. Thanks so much for giving Depfu a try!
This dependency update fixes known security vulnerabilities. Please see the details below and assess their impact carefully. We recommend to merge and deploy this as soon as possible!
Here is everything you need to know about this update. Please take a good look at what changed and the test results before merging this pull request.
What changed?
↗ ️ tzinfo (indirect, 1.2.7 → 1.2.10) · Repo · Changelog
Security Advisories 🚨
🚨 TZInfo relative path traversal vulnerability allows loading of arbitrary files
Impact
Affected versions
- 0.3.60 and earlier.
- 1.0.0 to 1.2.9 when used with the Ruby data source (tzinfo-data).
Vulnerability
With the Ruby data source (the tzinfo-data gem for tzinfo version 1.0.0 and
later and built-in to earlier versions), time zones are defined in Ruby files.
There is one file per time zone. Time zone files are loaded withrequire
on
demand. In the affected versions,TZInfo::Timezone.get
fails to validate
time zone identifiers correctly, allowing a new line character within the
identifier. With Ruby version 1.9.3 and later,TZInfo::Timezone.get
can be
made to load unintended files withrequire
, executing them within the Ruby
process.For example, with version 1.2.9, you can run the following to load a file with
path/tmp/payload.rb
:TZInfo::Timezone.get(\"foo\ /../../../../../../../../../../../../../../../../tmp/payload\")The exact number of parent directory traversals needed will vary depending on
the location of the tzinfo-data gem.TZInfo versions 1.2.6 to 1.2.9 can be made to load files from outside of the
Ruby load path. Versions up to and including 1.2.5 can only be made to load
files from directories within the load path.This could be exploited in, for example, a Ruby on Rails application using
tzinfo version 1.2.9, that allows file uploads and has a time zone selector
that accepts arbitrary time zone identifiers.
The CVSS score and severity have been set on this basis.Versions 2.0.0 and later are not vulnerable.
Patches
Versions 0.3.61 and 1.2.10 include fixes to correctly validate time zone
identifiers.Note that version 0.3.61 can still load arbitrary files from the Ruby load
path if their name follows the rules for a valid time zone identifier and the
file has a prefix oftzinfo/definition
within a directory in the load path.
For example if/tmp/upload
was in the load path, then
TZInfo::Timezone.get('foo')
could load a file with path
/tmp/upload/tzinfo/definition/foo.rb
. Applications should ensure that
untrusted files are not placed in a directory on the load path.Workarounds
As a workaround, the time zone identifier can be validated before passing to
TZInfo::Timezone.get
by ensuring it matches the regular expression
\\A[A-Za-z0-9+\\-_]+(?:\\/[A-Za-z0-9+\\-_]+)*\\z
.
Release Notes
1.2.10
- Fixed a relative path traversal bug that could cause arbitrary files to be loaded with require when used with
RubyDataSource
. Please refer to
GHSA-5cm2-9h8c-rvfx for details. CVE-2022-31163.- Ignore the SECURITY file from Arch Linux's tzdata package. #134.
1.2.9
- Fixed an incorrect
InvalidTimezoneIdentifier
exception raised when loading a zoneinfo file that includes rules specifying an additional transition to the final defined offset (for example, Africa/Casablanca in version 2018e of the Time Zone Database). #123.
1.2.8
- Added support for handling "slim" format zoneinfo files that are produced by default by zic version 2020b and later. The POSIX-style TZ string is now used calculate DST transition times after the final defined transition in the file. The 64-bit section is now always used regardless of whether Time has support for 64-bit times. #120.
- Rubinius is no longer supported.
Does any of this look wrong? Please let us know.
Commits
See the full diff on Github. The new version differs by 37 commits:
Fix the release date.
Preparing v1.2.10.
Merge branch 'fix-directory-traversal-1.2' into 1.2
Remove unnecessary escaping of + within regex character classes.
Fix relative path loading tests.
Remove `private_constant` for consistency and compatibility.
Exclude Arch Linux's SECURITY file from the time zone index.
Workaround for 'Permission denied - NUL' errors with JRuby on Windows.
Update copyright years.
Fix directory traversal in Timezone.get when using Ruby data source
Add JRuby 9.3.
Switch to ruby/setup-ruby for 1.9.3 (non-Windows) and 2.0.0 (x64).
Fix a typo.
Update copyright years.
Convert from CRLF to LF line endings.
Remove an unnecessary or.
Add RubyGems logo.
Ignore warnings from sub-process tests.
Switch to GitHub Actions for CI.
Preparing v1.2.9.
Remove JRuby 9.0.5.0.
Download GlobalSign Root CA - R3 for use with older Ruby versions.
Add 1.8.7-head, 1.9.2-p330, jruby-9.0.5.0 and ree to allow failures.
Update to JRuby 9.2.14.0.
Ignore generated transations that do not change the offset.
[ci skip] Add issue number reference.
Preparing v1.2.8.
Update time zone test fixtures based on tzdata 2020d.
Support "slim" zoneinfo files produced by default by zic >= 2020b.
Use up to date Linux distros to test (where possible).
Remove the deprecated sudo option.
Switch to travis-ci.com.
Update to Ruby 2.7.2 and JRuby 9.2.13.0.
Revert "Add Ruby 2.7 on AppVeyor."
Add Ruby 2.7 on AppVeyor.
Stop supporting Rubinius.
Update to Ruby 2.4.10.
Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with @depfu rebase
.
All Depfu comment commands
- @depfu rebase
- Rebases against your default branch and redoes this update
- @depfu recreate
- Recreates this PR, overwriting any edits that you've made to it
- @depfu merge
- Merges this PR once your tests are passing and conflicts are resolved
- @depfu close
- Closes this PR and deletes the branch
- @depfu reopen
- Restores the branch and reopens this PR (if it's closed)
- @depfu pause
- Ignores all future updates for this dependency and closes this PR
- @depfu pause [minor|major]
- Ignores all future minor/major updates for this dependency and closes this PR
- @depfu resume
- Future versions of this dependency will create PRs again (leaves this PR as is)