Skip to content
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

Cookie sameSite attribute #20

Open
knutov opened this issue Jan 4, 2022 · 0 comments
Open

Cookie sameSite attribute #20

knutov opened this issue Jan 4, 2022 · 0 comments

Comments

@knutov
Copy link
Contributor

knutov commented Jan 4, 2022

Cookie “dancer.session” 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

I found the problem can be solved that way:

PERL_CPANM_OPT=" --notest " cpanm [email protected]_03

add session_same_site: Strict to config.yml

Download to the local folder and edit Dancer::Session::Cookie.pm:

sub _cookie_params {
    my $self     = shift;
    my $name     = $self->session_name;
    my $duration = $self->_session_expires_as_duration;
    my %cookie   = (
        name      => $name,
        value     => $self->_cookie_value,
        path      => setting('session_cookie_path') || '/',
        domain    => setting('session_domain'),
        secure    => setting('session_secure'),
        http_only => setting("session_is_http_only") // 1, # <- changed
        same_site => setting("session_same_site"), # <- changed
    );
    if ( defined $duration ) {
        $cookie{expires} = time + $duration;
    }
    return %cookie;
}

Would you please make new release with this changes, if they are ok?

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

No branches or pull requests

1 participant