rch850 の上澄み

技術的な話題とか、雑談とか。タイトルを上澄みに変えました @ 2020/09/02

Cookie の SameSite の挙動を確認するための Chrome のコマンドライン引数

chrome://flags で設定しても確かめられるけど、それだと Chrome の完全再起動が必要だし、とりあえず Canary で一時的にサクッと確認したーい!っていう自分のためのコマンド。

/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --enable-features=SameSiteByDefaultCookies,CookiesWithoutSameSiteMustBeSecure,SameSiteDefaultChecksMethodRigorously

それぞれの効果はというと

  • SameSiteByDefaultCookies
    • chrome://flags/#same-site-by-default-cookies と同じ。
    • Treat cookies that don't specify a SameSite attribute as if they were SameSite=Lax. Sites must specify SameSite=None in order to enable third-party usage.
    • SameSite 属性を指定していない cookie は SameSite=Lax 扱いになるよ。一番よく言われてるやつ。
  • CookiesWithoutSameSiteMustBeSecure
    • chrome://flags/#cookies-without-same-site-must-be-secure と同じ。
    • If enabled, cookies without SameSite restrictions must also be Secure. If a cookie without SameSite restrictions is set without the Secure attribute, it will be rejected. This flag only has an effect if "SameSite by default cookies" is also enabled.
    • Chrome Platform Status によれば SameSite=None なのに Secure 属性がない cookie は無視しますよ、というもの。
    • 素直に訳すと、 SameSite 属性も Secure 属性も無い cookie は無視しますよ、と読めるけど、きっと何かの間違い。
  • SameSiteDefaultChecksMethodRigorously
    • Lax+POST を無効化する。
    • SameSiteByDefaultCookies を指定すれば自動的に Lax+POST も動かなくなるものだと思ってたんだけど、そんなことはなかった。
    • なぜかこれだけ chrome://flags に無い。

参考資料: