mojo icon indicating copy to clipboard operation
mojo copied to clipboard

Feature request: Support session cookies with "Partitioned"

Open nchaigne opened this issue 1 year ago • 5 comments

Third-party cookies will "soon" be phased out. As seen in Firefox console for example:

Cookie "mojolicious" will soon be rejected because it is foreign and does not have the "Partitioned" attribute.

I would like Mojolicious to support "Partitioned" session cookies, so we can keep using session cookies with CORS.

Thank you for considering this.

nchaigne avatar May 14 '24 13:05 nchaigne

Without a spec this seems unlikely to happen.

kraih avatar May 14 '24 13:05 kraih

What do you mean ? Do I need to specify how to do this ? or do we need an official spec from Mozilla / Google ?

nchaigne avatar May 14 '24 13:05 nchaigne

Without a spec this seems unlikely to happen.

Here are the specs: https://developer.mozilla.org/en-US/docs/Web/Privacy/Privacy_sandbox/Partitioned_cookies

@nchaigne e this is what I did:

                my $partitioned = $app->sessions->cookie_path;
                $partitioned =~ s/(?:; Partitioned)*$/; Partitioned/;
                $app->sessions->cookie_path($partitioned);

As the path parameter of cookie_path is not checked, it works.

Maybe this would be better?

                my $partitioned = $app->sessions->cookie_path;
                if (not $partitioned =~/; Partitioned(;|$)/) {
                    $app->sessions->cookie_path($partitioned . '; Partitioned');
                }

Skeeve avatar Jun 25 '24 11:06 Skeeve

Gives current browser support, i'd be in favour of this feature.

kraih avatar Jul 20 '24 23:07 kraih

Gives current browser support, i'd be in favour of this feature.

You mean like this?

https://developer.mozilla.org/en-US/docs/Web/Privacy/Privacy_sandbox/Partitioned_cookies#browser_compatibility

Skeeve avatar Jul 22 '24 06:07 Skeeve