Misc #15893

open-uri: status

Added by zverok (Victor Shepelev) 6 months ago. Updated 4 months ago.



On the one hand, Ruby 2.5's NEWS stated: method defined as an alias to open-uri's open-uri's will be deprecated in future.

I believe there were good reasons for that decision.

On the other hand,

  • no movements in this direction were done since 2.5
  • is excluded from open-uri's docs, and the main library's documentation doesn't mention this option as preferred or even existing.

I'd like to know what the real status of this library and its migration to (safer)
Should a patch be provided to change the library's docs accordingly?
Maybe even change the code (still leaving option, but just as an alias, moving the implementation away from that method)?


deprecate-open-uri-kernel-open.patch (21.3 KB) deprecate-open-uri-kernel-open.patch jeremyevans0 (Jeremy Evans), 06/02/2019 03:46 AM

Associated revisions

Revision 05aac90a
Added by akr (Akira Tanaka) 4 months ago

Warn open-uri's "open" method at Kernel.

Use instead.

Thanks for the patch by jeremyevans0 (Jeremy Evans) [Misc #15893].


Updated by jeremyevans0 (Jeremy Evans) 6 months ago

While the conversion from open or to is simple, this is likely to break a lot of existing Ruby code. However, I can see the security advantages of deprecating this, as having open implicitly open URIs is a security footgun. For that reason, I am in favor of the deprecation and eventual removal.

akr is the maintainer of open-uri, so I'm assigning this to him. In case he decides to deprecate this, attached is a patch for the deprecation. It makes call in cases where would handle it, warning in that case. To avoid warning when calling with a Pathname instance, it does not delegate to if the object responds to to_path.


Updated by akr (Akira Tanaka) 4 months ago

  • Status changed from Assigned to Closed

Applied in changeset git|05aac90a1bcfeb180f5e78ea8b00a4d1b04d5eed.

Warn open-uri's "open" method at Kernel.

Use instead.

Thanks for the patch by jeremyevans0 (Jeremy Evans) [Misc #15893].

Also available in: Atom PDF