Skip to content

Error in cookie #72

@winkelco

Description

@winkelco

Hi guys. I think I found a problem with the Footprinter.php file.

on the line 21 we have this function

public function footprint(Request $request): string
{
        $this->request = $request;

        if ($request->hasCookie(config('footprints.cookie_name'))) {
            return $request->cookie(config('footprints.cookie_name'));
        }

        // This will add the cookie to the response
        Cookie::queue(
            config('footprints.cookie_name'),
            $footprint = substr($this->fingerprint(), 0, 255),
            config('footprints.attribution_duration'),
            null,
            config('footprints.cookie_domain')
        );

        return $footprint;
}

the problem is in the line 32 because laravel make a cookie encryptation and then the first request returns the value stored in the variable $footprint

but the second request returns the cookie value encrypted

my solution was to add the cookie name in the EncryptCookies middleware and so we prevent laravel from changing the value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions