ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:111221] [Ruby master Bug#19188] Ruby 2.7.7 CGI Cookie Processing
@ 2022-12-06 18:26 apremdas@yahoo.co.uk (Andrew Premdas)
  2022-12-06 18:39 ` [ruby-core:111223] " alanwu (Alan Wu)
  2022-12-07  3:55 ` [ruby-core:111226] " mame (Yusuke Endoh)
  0 siblings, 2 replies; 3+ messages in thread
From: apremdas@yahoo.co.uk (Andrew Premdas) @ 2022-12-06 18:26 UTC (permalink / raw)
  To: ruby-core

Issue #19188 has been reported by apremdas@yahoo.co.uk (Andrew Premdas).

----------------------------------------
Bug #19188: Ruby 2.7.7 CGI Cookie Processing
https://bugs.ruby-lang.org/issues/19188

* Author: apremdas@yahoo.co.uk (Andrew Premdas)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5) [arm64-darwin22]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
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




-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:111223] [Ruby master Bug#19188] Ruby 2.7.7 CGI Cookie Processing
  2022-12-06 18:26 [ruby-core:111221] [Ruby master Bug#19188] Ruby 2.7.7 CGI Cookie Processing apremdas@yahoo.co.uk (Andrew Premdas)
@ 2022-12-06 18:39 ` alanwu (Alan Wu)
  2022-12-07  3:55 ` [ruby-core:111226] " mame (Yusuke Endoh)
  1 sibling, 0 replies; 3+ messages in thread
From: alanwu (Alan Wu) @ 2022-12-06 18:39 UTC (permalink / raw)
  To: ruby-core

Issue #19188 has been updated by alanwu (Alan Wu).

Status changed from Open to Closed

This is already fixed on the master branch: https://github.com/ruby/ruby/commit/745dcf5326ea2c8e2047a3bddeb0fbb7e7d07649

----------------------------------------
Bug #19188: Ruby 2.7.7 CGI Cookie Processing
https://bugs.ruby-lang.org/issues/19188#change-100513

* Author: apremdas@yahoo.co.uk (Andrew Premdas)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5) [arm64-darwin22]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
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




-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:111226] [Ruby master Bug#19188] Ruby 2.7.7 CGI Cookie Processing
  2022-12-06 18:26 [ruby-core:111221] [Ruby master Bug#19188] Ruby 2.7.7 CGI Cookie Processing apremdas@yahoo.co.uk (Andrew Premdas)
  2022-12-06 18:39 ` [ruby-core:111223] " alanwu (Alan Wu)
@ 2022-12-07  3:55 ` mame (Yusuke Endoh)
  1 sibling, 0 replies; 3+ messages in thread
From: mame (Yusuke Endoh) @ 2022-12-07  3:55 UTC (permalink / raw)
  To: ruby-core

Issue #19188 has been updated by mame (Yusuke Endoh).


You may want to use cgi gem 0.3.6

----------------------------------------
Bug #19188: Ruby 2.7.7 CGI Cookie Processing
https://bugs.ruby-lang.org/issues/19188#change-100515

* Author: apremdas@yahoo.co.uk (Andrew Premdas)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5) [arm64-darwin22]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
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




-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

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

end of thread, other threads:[~2022-12-07  3:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-06 18:26 [ruby-core:111221] [Ruby master Bug#19188] Ruby 2.7.7 CGI Cookie Processing apremdas@yahoo.co.uk (Andrew Premdas)
2022-12-06 18:39 ` [ruby-core:111223] " alanwu (Alan Wu)
2022-12-07  3:55 ` [ruby-core:111226] " mame (Yusuke Endoh)

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).