-
Notifications
You must be signed in to change notification settings - Fork 0
ETT-310, ETT-309: Role switcher for resource sharing; fixes for cookie handling #119
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
Conversation
d8297d0
to
1de9c93
Compare
fc17034
to
1649f9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carylwyatt Are we still using this component at all (given that we now have the cookie consent banner) or could we remove it? I couldn't find any references to it but I might not be looking in the right way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup looks like you removed it in the svelte 5 branch anyway
); | ||
}, | ||
setItem: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) { | ||
setItem: function (sKey, sValue, duration = 365) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thought here is that a default duration of 365 days isn't exactly the same as 12 months (what we were doing before) but it's probably good enough and simplifies calling setItem
(sDomain ? '; domain=' + sDomain : '') + | ||
(sPath ? '; path=' + sPath : '') + | ||
(bSecure ? '; secure' : ''); | ||
(HT.cookies_domain ? '; domain=' + HT.cookies_domain : '') + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have any use cases for setting any of these parameters differently by cookie right now, so I removed this as a parameter. If we need it in the future we could add it back (perhaps with a default value)
(HT.cookies_domain ? '; domain=' + HT.cookies_domain : '') + | ||
('; path=/') + | ||
(HT.secure_cookies ? '; secure' : '') + | ||
( '; SameSite=Lax') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding SameSite=Lax
to all cookies mitigates warnings in Firefox that this will be the default in the future.
@moseshll The only case I can think of where we could potentially be relying on 3rd party cookies is for the embedding in CRMS, but that's still all from the same domain, so it should all work.... right?
Are there any other cases where we could potentially rely on third-party cookies working? I feel like in general these days many browsers/people block them anyway, so we probably would have found out about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CRMS only uses cookies to remember a few pagination/view settings in its own pages. Shouldn't be any bleed between that and mdp apps.
document.cookie = "COOKIE=true;expires=Thu, 01 Jan 1970 00:00:00 GMT" | ||
document.cookie = "COOKIE=cookie;expires=Thu, 01 Jan 1970 00:00:00 GMT" | ||
}) | ||
beforeEach(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing this in a before block to ensure the state before we run the test seems generally more idiomatic to me.
We also need to add the path since now we are setting that by default on all cookies (and things might not always work as expected for cookies without paths anyway)
1649f9a
to
b1c4f64
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks good to me! Thanks for fixing all that cookie stuff, what a headache!
* If running locally, don't set the cookie domain at all (some browsers reject such cookies) * If running in dev, don't set "secure cookies" unless we're using https * Refactor cookie settings to eliminate duplicative parameters/unused logic
b1c4f64
to
312c29b
Compare
See comments on individual PRs. For testing with hathitrust/babel#113