Footprints icon indicating copy to clipboard operation
Footprints copied to clipboard

Error in cookie

Open winkelco opened this issue 2 years ago • 0 comments

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.

winkelco avatar Nov 18 '22 18:11 winkelco