Problem

When a user has accepted the cookie compliance, a warning gets displayed in Firefox about the sameSite attribute missing a secure flag.

Cookie “cookie-agreed” will be soon rejected because it has the “sameSite” attribute set to “none” or an invalid value, without the “secure” attribute. To know more about the “sameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite

There is already a related issue for d7, linked in the Related issues section.

Proposed solution

Add secure: true attribute when setting the cookies.

Comments

sasanikolic created an issue. See original summary.

sasanikolic’s picture

Status: Active » Needs review
StatusFileSize
new1.63 KB

Here is the proposed patch that fixes the warning.

berdir’s picture

Unsure about the fix.

This would mean that the cookie isn't sent anymore on http. But that might not actually matter because we don't want this cookie to be sent anyway, it's a JS only thing.

So maybe this could actually use local storage instead? Of course we still need to support a cookie that's already set.

Before working on that, lets wait on feedback from the maintainer.

berdir’s picture

Status: Needs review » Needs work
svenryen’s picture

Although I'm not an expert on SameSite and Secure cookies, I would assume we need a variation of SameSite, such as SameSite=Lax, rather than Secure, which indeed would cause all non secure sites to break?

@sasanikolic, which version of Firefox threw the error that you reported?

svenryen’s picture

I read up on SameSite, and it seems we can't use None, as it implies we need to add Secure as well. Question is, should we use Lax or Strict? Since there's no content in the cookie that can be abused, maybe we can go for Lax? It would be beneficial in the event should some site for whatever reason want to share the cookie allowed state with another site?

svenryen’s picture

Status: Needs work » Postponed (maintainer needs more info)
_san_’s picture

I'm seeing this warning on my site. What info do you need to work on this issue?

svenryen’s picture

Status: Postponed (maintainer needs more info) » Active

The proposed patch introduces a Secure flag which to my knowledge seems to break sites hosted on http. It's unclear to me whether we would like to use Lax or Strict or leave it up to the admin user to make a decision. I'll see if I can provide a patch that uses "Strict" and we can test that as a starter.

svenryen’s picture

StatusFileSize
new2.95 KB

@ssteigen can you let me know if you see this warning in all browsers?

I have made a patch for D8. Is that okay, or do you need one for D7?
For D7 more work is involved, as we will have to replace jquery-cookie with a different library. I couldn't find an immediate solution and will have to return to this later for D7.

For D8, can you take a look at this patch, try to apply it and see if it fixes your issue?

svenryen’s picture

svenryen’s picture

svenryen’s picture

Actually, re-reading my comment in #10, I see now we can't use the patch in #11. Hiding it.

neslee canil pinto’s picture

Status: Active » Reviewed & tested by the community
StatusFileSize
new424.37 KB

Patch for d8 is working fine after applying the patch, it's not affecting the correct functionality and setting sameSite attribute.

neslee canil pinto’s picture

Assigned: neslee canil pinto » Unassigned
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.