question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Frappe can't set a cookie's SameSite attribute to the string literal "None" because werkzeug is outdated

See original GitHub issue

Description of the issue

Cookies may need the “SameSite” attribute set to the string literal “None”. They were set to None here, which means it defaults to “Lax” most of the time. It cannot be set to “None” unless werkzeug is updated to incorporate this change. I think therefore that frappe should use werkzeug 1.0.0 at least.

Context information (for bug reports)

I’m attempting to build a flutter application, which uses simple authentication. Hard-coding the changes described above, and the cookie’s “Secure” attribute allow me to retrieve the sid cookie, and authenticate my users in development.

Output of bench version

WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`

5.0.0-dev

Steps to reproduce the issue

  1. Set up a frappe backend
  2. Set up a flutter client with the withCredentials attribute to send a login request
  3. Send the login request

Observed result

The browser complains that the cookie could not be stored.

Expected result

The browser should just store the cookie, which flutter then handles.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ceefourcommented, Jun 15, 2022

@ankush Thank you !!! So glad to hear that.

It’s unfortunate that ERPNext v13 can’t upgrade, but since there’s a workaround with nginx, this isn’t so bad.

Thank you @daraul for giving the workaround.

1reaction
daraulcommented, Nov 10, 2021

I took a wild guess based on this line and set the “device” parameter to “mobile” alongside my user’s login information. That did the trick, but I don’t recall seeing this functionality mentioned in the documentation. I would suggest the docs be updated in addition to werkzeug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

php - How to fix "set SameSite cookie to none" warning?
A cookie associated with a cross-site resource at (Here is my domain) was set without the SameSite attribute. A future release of Chrome...
Read more >
Set samesite cookie attribute for PHP sessions - Drupal
Explicitly set the samesite cookie attribute (default: None). ... empty string, etc), the attribute won't be set at all (same behavior as ...
Read more >
Request / Response Objects — Werkzeug Documentation (2.2 ...
Since Werkzeug 0.6 it's safe to use the same response object for multiple WSGI responses. It's possible to create copies using copy.deepcopy ....
Read more >
SameSite cookies - HTTP - MDN Web Docs
Cookie "myCookie" rejected because it has the "SameSite=None" attribute but is missing the "secure" attribute. This Set-Cookie was blocked ...
Read more >
The New cookieFlags Setting In Google Analytics - Simo Ahava
On top of these, in the latest version of the Google Chrome browser, the cookie will also be treated as having the SameSite=Lax...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found