Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Rubyzip 2 #646

Open
fabdbt opened this issue Oct 1, 2019 · 6 comments
Open

Upgrade Rubyzip 2 #646

fabdbt opened this issue Oct 1, 2019 · 6 comments
Labels
Done in caxlsx This has already been solved in the caxlsx fork.

Comments

@fabdbt
Copy link

fabdbt commented Oct 1, 2019

Could you please unlock rubyzip version to use newest version 2 ? https://github.com/rubyzip/rubyzip/releases/tag/v2.0.0

@toncid
Copy link

toncid commented Oct 1, 2019

There is a vulnerability in rubyzip < 1.3: rubyzip/rubyzip#403

@fabdbt
Copy link
Author

fabdbt commented Oct 2, 2019

By unlock, I do not mean allowing rubyzip versions prior to 1.3. I mean allowing people to use axlsx gem with rubyzip >= 1.3 and so rubyzip >= 2.

@chriscz
Copy link

chriscz commented Oct 31, 2019

@Apokly I've had success with the following polyfill on rubyzip == 1.2.1. YMMV.
edit: simplified it, but misread the question. regardless; useful nonetheless.

Place a file ``zip.rb'' as below

lib/
  zip/
    zip.rb

zip.rb

# Polyfill to make AXLSX package work with v1.2.x `zip` which no longer defines `Zip::Zip`
require 'zip'
require 'zip/output_stream'

module Zip
  class ZipOutputStream < OutputStream
    def initialize(filename, stream = false)
      if stream
        filename = StringIO.new
      end
      super(filename, stream)
    end
  end
end

@noniq
Copy link
Collaborator

noniq commented Oct 31, 2019

There’s now a community-supported fork of axlsx: https://github.com/caxlsx/caxlsx

Versions 2.0.2 and 3.0.x have been released, both supporting newer versions of Rubyzip. See https://rubygems.org/gems/caxlsx/versions/3.0.1

@noniq noniq added the Done in caxlsx This has already been solved in the caxlsx fork. label Dec 15, 2019
@baburdick
Copy link

Note: there have since been more critical vulnerabilities discovered in rubyzip v1.0.0:

Taking a serious look at https://github.com/caxlsx/caxlsx ...

@noniq
Copy link
Collaborator

noniq commented Nov 11, 2021

As far as I understand, both vulnerabilities are in the context of extracting archives. Axlsx only creates archives.

However, it’s a very bad idea to have a vulnerable version of Rubyzip in your project at all, so please upgrade to at least caxlsx 2.0.2 or 3.0.1.

In caxlsx it's also possible to use an external zip program instead of Rubyzip, see https://www.rubydoc.info/gems/caxlsx/Axlsx/Package#serialize-instance_method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Done in caxlsx This has already been solved in the caxlsx fork.
Projects
None yet
Development

No branches or pull requests

5 participants