Project

General

Profile

Actions

Bug #19188

closed

Ruby 2.7.7 CGI Cookie Processing

Added by apremdas@yahoo.co.uk (Andrew Premdas) almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5) [arm64-darwin22]
[ruby-core:111221]

Description

This is my first bug report here, apologies if I mess things up.

Ruby 2.7.7 introduced a code change in lib/ruby/2.7.0/cgi/cookie.rb. There is now a custom setter for the domain attribute. You can see me debugging this below

   126:     def domain=(str)
   127:       byebug
=> 128:       if str and ((str = str.b).bytesize > 255 or !DOMAIN_VALUE_RE.match?(str))
   129:         raise ArgumentError, "invalid domain: #{str.dump}"
   130:       end

When you are running a test on rails using capybara and rspec the value of domain will be ".example.com". This value is the same on ruby 2.7.6. The new code in 2.7.7 rejects this code as an invalid domain because DOMAIN_VALUE_RE.match?(str) is false.

I think DOMAIN_VALUE_RE needs to be changed so it matches ".example.com" otherwise lots of tests on Rails applications are going to fail

Updated by alanwu (Alan Wu) almost 2 years ago

  • Status changed from Open to Closed

Updated by mame (Yusuke Endoh) almost 2 years ago

You may want to use cgi gem 0.3.6

Actions

Also available in: Atom PDF

Like0
Like0Like0