Skip to content

Cookie Secure Only Flag Handling #1840

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

Open
titusfortner opened this issue Feb 3, 2021 · 6 comments
Open

Cookie Secure Only Flag Handling #1840

titusfortner opened this issue Feb 3, 2021 · 6 comments

Comments

@titusfortner
Copy link

System

  • Version: 0.29
  • Platform: Mac, Linux
  • Firefox: 84.0.2
  • Selenium: 4 alpha

Chrome & Firefox have different behaviors for handling "secure-only-flag"
Chrome will not set the cookie with secure-only-flag on an http URL; Firefox will
The spec isn't exactly clear on this: https://w3c.github.io/webdriver/#dfn-cookie-secure-only
But the Chrome actions seem to make more sense to me.

Testcase

Here's the Selenium test that is failing, but will apply for any http URL:
https://github.com/SeleniumHQ/selenium/blob/trunk/rb/spec/integration/selenium/webdriver/manager_spec.rb#L67

Stacktrace

Here's the test result:
(cookie is set when I would expect that it not be)
https://github.com/SeleniumHQ/selenium/runs/1816108484?check_suite_focus=true#step:8:527

@whimboo
Copy link
Collaborator

whimboo commented Feb 4, 2021

Thanks @titusfortner. Would you mind to also file an issue for the WebDriver spec so that we can make it clear that setting a secure cookie should only be allowed on secure connections?

@whimboo
Copy link
Collaborator

whimboo commented Feb 4, 2021

I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1690739 but will wait with the implementation until the spec has been updated.

@titusfortner
Copy link
Author

Aha, it is specified in the cookies RFC

  1. If the scheme component of the request-uri does not denote a
    "secure" protocol (as defined by the user agent), and the
    cookie's secure-only-flag is true, then abort these steps and
    ignore the cookie entirely.

@whimboo
Copy link
Collaborator

whimboo commented Feb 8, 2021

The reference cookies RFC is a draft only. So I think what we can refer here is https://tools.ietf.org/html/rfc6265#section-4.1.2.5.

@whimboo
Copy link
Collaborator

whimboo commented Feb 10, 2021

I filed w3c/webdriver#1571 to get an agreement.

@noraj
Copy link

noraj commented Mar 16, 2023

rfc 2818 has been obsoleted by rfc 9110 which left draft state in June 2022.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants