HeaderEditor icon indicating copy to clipboard operation
HeaderEditor copied to clipboard

modify SameSite cookie Option

Open toasta opened this issue 5 years ago • 0 comments

Hi,

i'm trying to remove the SameSite attribute for cookies set by a site. I wrote this:

for (const a in val) {
  if (val[a].name.toLowerCase() === 'set-cookie') {
    console.debug("Got set-cookie", val[a].value);
    t=val[a].value.replace(/SameSite=(Strict|Lax)/i, "SameSite=None");
    val[a].value=t;
    console.debug("changed set-cookie", val[a].value);
    break;
  }
}

this is what debugging says:

Got set-cookie cid=%40[...]; expires=Wed, 28-Oct-2020 13:02:35 GMT; Max-Age=2419200; path=/; secure; httponly; SameSite=Lax background.js line 1 > Function:5:9
changed set-cookie cid=%40[...]; expires=Wed, 28-Oct-2020 13:02:35 GMT; Max-Age=2419200; path=/; secure; httponly; SameSite=None background.js line 1 > Function:8:9

but the cookie still get's set with Lax. tried w/o the regex as well and according to the logging it matches and modifies it. Maybe the set-cookie line is processed before the plugin had a chance to change it?

ot: is it normal to see the raw and unmodified requests in firebug/console?

Thx in advance

Benedikt

toasta avatar Sep 30 '20 13:09 toasta