Skip to content

Conversation

aelkiss
Copy link
Member

@aelkiss aelkiss commented Jun 5, 2025

See comments on individual PRs. For testing with hathitrust/babel#113

@aelkiss aelkiss requested a review from carylwyatt June 5, 2025 12:33
@aelkiss aelkiss force-pushed the ETT-310-rs-role-switch branch from d8297d0 to 1de9c93 Compare June 5, 2025 16:27
@aelkiss aelkiss marked this pull request as ready for review June 5, 2025 16:28
@aelkiss aelkiss force-pushed the ETT-310-rs-role-switch branch 2 times, most recently from fc17034 to 1649f9a Compare June 5, 2025 17:21
Copy link
Member Author

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

Copy link
Member Author

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) {
Copy link
Member Author

@aelkiss aelkiss Jun 5, 2025

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 : '') +
Copy link
Member Author

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')
Copy link
Member Author

@aelkiss aelkiss Jun 5, 2025

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?

Copy link

@moseshll moseshll Jun 5, 2025

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(() => {
Copy link
Member Author

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)

@aelkiss aelkiss force-pushed the ETT-310-rs-role-switch branch from 1649f9a to b1c4f64 Compare June 5, 2025 18:17
Copy link
Member

@carylwyatt carylwyatt left a 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
@aelkiss aelkiss force-pushed the ETT-310-rs-role-switch branch from b1c4f64 to 312c29b Compare June 5, 2025 18:41
@aelkiss aelkiss merged commit aa04ac1 into main Jun 5, 2025
4 of 6 checks passed
@aelkiss aelkiss deleted the ETT-310-rs-role-switch branch June 5, 2025 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants