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

core/Cookie.php:Cookie->delete() don't set secure and SameSite. #16637

Closed
renefreund opened this issue Oct 30, 2020 · 1 comment · Fixed by #17255
Closed

core/Cookie.php:Cookie->delete() don't set secure and SameSite. #16637

renefreund opened this issue Oct 30, 2020 · 1 comment · Fixed by #17255
Labels
Bug For errors / faults / flaws / inconsistencies etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.
Milestone

Comments

@renefreund
Copy link

Hi,

We use AjaxOptOut-Plugin instead of the OptOut-Iframe: https://plugins.matomo.org/AjaxOptOut?piwikversion=3.

Matomo-Host and Website-Host don't share the same Domainname and use https.

The IgnoreCookie::setIgnoreCookie(); function works fine.

But IgnoreCookie::getIgnoreCookie()->delete(); fails to delete the "piwik_ignore".

Browser (like Chrome 86) mention that SameSite isn't set.

After some investigation we found the cause in /core/Cookie.php

    public function delete()
    {
        $this->setP3PHeader();
        $this->setCookie($this->name, 'deleted', time() - 31536001, $this->path, $this->domain);
    }

Here is no handling, if SSL or Samesite is needed. We quick-patched it by setting the "delete" the ignore-cookie two times.

    public function delete()
    {
        $this->setP3PHeader();
        $this->setCookie($this->name, 'deleted', time() - 31536001, $this->path, $this->domain);
        $this->setCookie($this->name, 'deleted', time() - 31536001, $this->path, $this->domain, TRUE, FALSE, 'None');
    }

Now the first cookie gets ignored by Chrome, but the second cookie is accepted.

I hope you have a better idea to solve this problem.

i don't know if any issue in the cookie-meta-issue #14904 already cover that (i haven't found that scenario there).

Greetings
René

@tsteur tsteur added the Bug For errors / faults / flaws / inconsistencies etc. label Nov 1, 2020
@tsteur tsteur added this to the 4.1.0 milestone Nov 1, 2020
@tsteur tsteur added the Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. label Nov 1, 2020
@tsteur
Copy link
Member

tsteur commented Nov 1, 2020

Thank you for creating this issue. I thought we already have an issue for this but doesn't look like it.

@mattab mattab modified the milestones: 4.1.0, 4.2.0 Dec 21, 2020
@mattab mattab modified the milestones: 4.2.0, 4.3.0 Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants