SESSION_COOKIE_SAMESITE not woking
See original GitHub issueI wanted to embed dashboard to iframe, but got cross-site issue. But I don’t want to use PUBLIC_ROLE_LIKE_GAMMA = True
and let everyone who knows the link to access my dashbaord. The solution I found was to set SESSION_COOKIE_SAMESITE = None
. The feature have existed after flask 1.0 #2607 changed log
But no matter what I set, the samesite
attribute has never shown up.
I can assure that flask and werkzung both are right version. #1549 and use the right config file.
Expected Behavior
Set-Cookie: session=<session>; Expires=Mon, 23-Nov-2020 11:58:00 GMT; Path=/; secure; samesite=<whatever I set>
Actual Behavior
Set-Cookie: session=<session>; Expires=Mon, 23-Nov-2020 11:58:00 GMT; Path=/; secure
Example
- Try to set
samesite=strict
and without secure.
config.py
SESSION_COOKIE_SAMESITE = 'Strict'
SESSION_COOKIE_HTTPONLY = False
SESSION_COOKIE_SECURE = False
result
- Try to set
samesite=lax
and with secure.
config.py
SESSION_COOKIE_SAMESITE = 'Lax'
SESSION_COOKIE_HTTPONLY = False
SESSION_COOKIE_SECURE = True
result
Environment
- Python version: 3.6
- Flask version: 1.1.2
- Werkzeug version: 1.0.1
- Superset version: 0.999.0dev
Checklist
Make sure to follow these steps before submitting your issue - thank you!
- I have checked the superset logs for python stacktraces and included it here as text if there are any.
- I have reproduced the issue with at least the latest released version of superset.
- I have checked the issue tracker for the same issue and I haven’t found one similar.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Session cookie set `SameSite=None; Secure;` does not work
I put the word secure inside the cookie and it worked properly, but because the word secure must be used next to samesite...
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 >Cookies SameSite mode 'None' not working - ComponentSpace
The ASP.NET session cookie must include aSameSite value of None and should be marked as secure. To achieve this: 1. Update the web...
Read more >Get Ready for New SameSite=None; Secure Cookie Settings
Only cookies with the SameSite=None ; Secure setting will be available for external access, provided they are being accessed from secure connections.
Read more >SameSite cookies explained - web.dev
Introducing the SameSite attribute on a cookie provides three different ways to control this behaviour. You can choose to not specify the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve solved this problem. The issue was cause by flask-session. #116 But the pull request haven’t merged yet. So I used the workaround from this issue #124
As displayed in the config comments (https://github.com/apache/incubator-superset/blob/master/superset/config.py#L918), you need to pass in
"None"
and notNone
to set the samesite attribute to “None”. This is an unfortunate naming collision between Python and web standards…Note I believe you also must set
SESSION_COOKIE_HTTPONLY
to True to set any of the samesite options as otherwise a malicious site could grab your cookie through JS and impersonate the user