ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:91812] [Ruby trunk Bug#15662] Fix CSV delegation to missing StringIO
       [not found] <redmine.issue-15662.20190313155707@ruby-lang.org>
@ 2019-03-13 15:57 ` gsamokovarov
  2019-03-13 16:14 ` [ruby-core:91813] " gsamokovarov
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: gsamokovarov @ 2019-03-13 15:57 UTC (permalink / raw)
  To: ruby-core

Issue #15662 has been reported by gsamokovarov (Genadi Samokovarov).

----------------------------------------
Bug #15662: Fix CSV delegation to missing StringIO
https://bugs.ruby-lang.org/issues/15662

* Author: gsamokovarov (Genadi Samokovarov)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
If you create a CSV from raw content like:

      csv = CSV.new("h1,h2")

You'll get method missing when calling `csv.path` but still, get `true` when you call `csv.respond_to?(:path)`.

This tricks 3rd party libraries like carrierwave which try to call `path` on their input if it responds to it.

See https://github.com/carrierwaveuploader/carrierwave/blob/a91ab69fdd8052cdf5a5e48ef8baf40939e441fb/lib/carrierwave/sanitized_file.rb#L109-L123

This stops me from passing CSV objects as StringIO's into carrierwave uploads, for example, but the problem can also be manifested in other 3rd party libraries, as responding to a method and returning a `NoMethodError` when calling it is still an unexpected behavior.

I have gone through the CSV delegation scheme and made sure that every method that StringIO doesn't respond to returns a meaningful zero value and does not raise a `NoMethodError` while used through a CSV Instance.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:91813] [Ruby trunk Bug#15662] Fix CSV delegation to missing StringIO
       [not found] <redmine.issue-15662.20190313155707@ruby-lang.org>
  2019-03-13 15:57 ` [ruby-core:91812] [Ruby trunk Bug#15662] Fix CSV delegation to missing StringIO gsamokovarov
@ 2019-03-13 16:14 ` gsamokovarov
  2019-03-13 20:13 ` [ruby-core:91818] " kou
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: gsamokovarov @ 2019-03-13 16:14 UTC (permalink / raw)
  To: ruby-core

Issue #15662 has been updated by gsamokovarov (Genadi Samokovarov).


I have opened a PR on GitHub's tracker with the changes: https://github.com/ruby/ruby/pull/2094

----------------------------------------
Bug #15662: Fix CSV delegation to missing StringIO
https://bugs.ruby-lang.org/issues/15662#change-77086

* Author: gsamokovarov (Genadi Samokovarov)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
If you create a CSV from raw content like:

      csv = CSV.new("h1,h2")

You'll get method missing when calling `csv.path` but still, get `true` when you call `csv.respond_to?(:path)`.

This tricks 3rd party libraries like carrierwave which try to call `path` on their input if it responds to it.

See https://github.com/carrierwaveuploader/carrierwave/blob/a91ab69fdd8052cdf5a5e48ef8baf40939e441fb/lib/carrierwave/sanitized_file.rb#L109-L123

This stops me from passing CSV objects as StringIO's into carrierwave uploads, for example, but the problem can also be manifested in other 3rd party libraries, as responding to a method and returning a `NoMethodError` when calling it is still an unexpected behavior.

I have gone through the CSV delegation scheme and made sure that every method that StringIO doesn't respond to returns a meaningful zero value and does not raise a `NoMethodError` while used through a CSV Instance.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:91818] [Ruby trunk Bug#15662] Fix CSV delegation to missing StringIO
       [not found] <redmine.issue-15662.20190313155707@ruby-lang.org>
  2019-03-13 15:57 ` [ruby-core:91812] [Ruby trunk Bug#15662] Fix CSV delegation to missing StringIO gsamokovarov
  2019-03-13 16:14 ` [ruby-core:91813] " gsamokovarov
@ 2019-03-13 20:13 ` kou
  2019-03-17  9:13 ` [ruby-core:91856] " gsamokovarov
  2019-03-17 20:56 ` [ruby-core:91857] " kou
  4 siblings, 0 replies; 5+ messages in thread
From: kou @ 2019-03-13 20:13 UTC (permalink / raw)
  To: ruby-core

Issue #15662 has been updated by kou (Kouhei Sutou).

Assignee set to kou (Kouhei Sutou)
Status changed from Open to Assigned

Could you use https://github.com/ruby/csv instead of ruby/ruby?
ruby/csv is the upstream repository.

----------------------------------------
Bug #15662: Fix CSV delegation to missing StringIO
https://bugs.ruby-lang.org/issues/15662#change-77090

* Author: gsamokovarov (Genadi Samokovarov)
* Status: Assigned
* Priority: Normal
* Assignee: kou (Kouhei Sutou)
* Target version: 
* ruby -v: 
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
If you create a CSV from raw content like:

      csv = CSV.new("h1,h2")

You'll get method missing when calling `csv.path` but still, get `true` when you call `csv.respond_to?(:path)`.

This tricks 3rd party libraries like carrierwave which try to call `path` on their input if it responds to it.

See https://github.com/carrierwaveuploader/carrierwave/blob/a91ab69fdd8052cdf5a5e48ef8baf40939e441fb/lib/carrierwave/sanitized_file.rb#L109-L123

This stops me from passing CSV objects as StringIO's into carrierwave uploads, for example, but the problem can also be manifested in other 3rd party libraries, as responding to a method and returning a `NoMethodError` when calling it is still an unexpected behavior.

I have gone through the CSV delegation scheme and made sure that every method that StringIO doesn't respond to returns a meaningful zero value and does not raise a `NoMethodError` while used through a CSV Instance.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:91856] [Ruby trunk Bug#15662] Fix CSV delegation to missing StringIO
       [not found] <redmine.issue-15662.20190313155707@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2019-03-13 20:13 ` [ruby-core:91818] " kou
@ 2019-03-17  9:13 ` gsamokovarov
  2019-03-17 20:56 ` [ruby-core:91857] " kou
  4 siblings, 0 replies; 5+ messages in thread
From: gsamokovarov @ 2019-03-17  9:13 UTC (permalink / raw)
  To: ruby-core

Issue #15662 has been updated by gsamokovarov (Genadi Samokovarov).


We resolved it in https://github.com/ruby/csv/pull/80. Thank you @kou 🙇‍♂️!

----------------------------------------
Bug #15662: Fix CSV delegation to missing StringIO
https://bugs.ruby-lang.org/issues/15662#change-77127

* Author: gsamokovarov (Genadi Samokovarov)
* Status: Assigned
* Priority: Normal
* Assignee: kou (Kouhei Sutou)
* Target version: 
* ruby -v: 
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
If you create a CSV from raw content like:

      csv = CSV.new("h1,h2")

You'll get method missing when calling `csv.path` but still, get `true` when you call `csv.respond_to?(:path)`.

This tricks 3rd party libraries like carrierwave which try to call `path` on their input if it responds to it.

See https://github.com/carrierwaveuploader/carrierwave/blob/a91ab69fdd8052cdf5a5e48ef8baf40939e441fb/lib/carrierwave/sanitized_file.rb#L109-L123

This stops me from passing CSV objects as StringIO's into carrierwave uploads, for example, but the problem can also be manifested in other 3rd party libraries, as responding to a method and returning a `NoMethodError` when calling it is still an unexpected behavior.

I have gone through the CSV delegation scheme and made sure that every method that StringIO doesn't respond to returns a meaningful zero value and does not raise a `NoMethodError` while used through a CSV Instance.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:91857] [Ruby trunk Bug#15662] Fix CSV delegation to missing StringIO
       [not found] <redmine.issue-15662.20190313155707@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2019-03-17  9:13 ` [ruby-core:91856] " gsamokovarov
@ 2019-03-17 20:56 ` kou
  4 siblings, 0 replies; 5+ messages in thread
From: kou @ 2019-03-17 20:56 UTC (permalink / raw)
  To: ruby-core

Issue #15662 has been updated by kou (Kouhei Sutou).

Status changed from Assigned to Closed

Thanks!

----------------------------------------
Bug #15662: Fix CSV delegation to missing StringIO
https://bugs.ruby-lang.org/issues/15662#change-77128

* Author: gsamokovarov (Genadi Samokovarov)
* Status: Closed
* Priority: Normal
* Assignee: kou (Kouhei Sutou)
* Target version: 
* ruby -v: 
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
If you create a CSV from raw content like:

      csv = CSV.new("h1,h2")

You'll get method missing when calling `csv.path` but still, get `true` when you call `csv.respond_to?(:path)`.

This tricks 3rd party libraries like carrierwave which try to call `path` on their input if it responds to it.

See https://github.com/carrierwaveuploader/carrierwave/blob/a91ab69fdd8052cdf5a5e48ef8baf40939e441fb/lib/carrierwave/sanitized_file.rb#L109-L123

This stops me from passing CSV objects as StringIO's into carrierwave uploads, for example, but the problem can also be manifested in other 3rd party libraries, as responding to a method and returning a `NoMethodError` when calling it is still an unexpected behavior.

I have gone through the CSV delegation scheme and made sure that every method that StringIO doesn't respond to returns a meaningful zero value and does not raise a `NoMethodError` while used through a CSV Instance.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-17 20:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-15662.20190313155707@ruby-lang.org>
2019-03-13 15:57 ` [ruby-core:91812] [Ruby trunk Bug#15662] Fix CSV delegation to missing StringIO gsamokovarov
2019-03-13 16:14 ` [ruby-core:91813] " gsamokovarov
2019-03-13 20:13 ` [ruby-core:91818] " kou
2019-03-17  9:13 ` [ruby-core:91856] " gsamokovarov
2019-03-17 20:56 ` [ruby-core:91857] " kou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).