Repository navigation
[Breaking] Samesite Cookie Fix - #8269
Merged
Merged
Conversation
- In DEBUG mode, turn off entirely - Allow False value (note: *not* a string) - Force insecure cookie in DEBUG mode
✅ Deploy Preview for inventree-web-pui-preview canceled.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8269 +/- ##
==========================================
- Coverage 84.22% 84.22% -0.01%
==========================================
Files 1162 1162
Lines 52517 52519 +2
Branches 1894 1894
==========================================
Hits 44235 44235
- Misses 7812 7814 +2
Partials 470 470
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This was referenced Oct 10, 2024
Merged
Contributor
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
1 of 7 tasks
2 of 6 tasks
1 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A previous PR which was well-intentioned to solve this issue has resulted in problems with session authentication.
PR #8262 changed the default value of
CSRF_COOKIE_SAMESITEandSESSION_COOKIE_SAMESITEfromNone (boolean value)to'None'(string value). This is in accordance with the django documentation which specifies that these values must be strings and notNone:However, note that the boolean value
Falseis allowed, which disables the cookie checks entirely.Our previous literal value
None(disallowed) was resulting a boolean check to evaluate the same as if the value was set toFalse(allowed):This means that (prior to this patch), the samesite cookie session was effectively set to
False(disabled), and not'None'- which has different implications in operation. However, this value was causing a downstream error in the allauth package.Changes
So, this PR makes the following adjustments:
Falseboolean literal)'None'toFalseFalseinDEBUGmode (to aid in easy development)Breaking
This is considered a "breaking" change because any production installation which has the samesite set to
Nonewill now evaluate to'None'instead ofFalse- resulting in different behaviour.Users in this predicament should change the value of
INVENTREE_COOKIE_SAMESITEfromNonetoFalseto disable the checks.References
Nonecauses errors #8254