AdguardTeam / Scriptlets

AdGuard scriptlets library
GNU General Public License v3.0
148 stars 29 forks source link

Fix 'trusted-set-cookie' — cannot set cookie if name has '__Secure-' prefix #448

Open AdamWr opened 1 month ago

AdamWr commented 1 month ago

Related issue - https://github.com/AdguardTeam/AdguardFilters/issues/187095

I'm trying to set my country on Hetzner via scriptlet but it seems the scriptlet is buggy. hetzner.com#%#//scriptlet('trusted-set-cookie-reload','__Secure-Hetzner_CountryCode','ot') adds the cookie but it gets overridden by default setting (DE) while hetzner.com#%#//scriptlet('trusted-set-cookie-reload','__Secure-Hetzner_CountryCode','ot') causes a reload loop on the website.

It looks like that cookie name with __Secure- prefix (the same for __Host-) requires secure flag otherwise it will be not set. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes