web-dev-qa-db-ja.com

CookieとSameSite +セキュア-ExpressJS

Expressアプリケーションで次の設定を行っているにもかかわらず、コンソールに次の警告が表示されています。誰かが以前にこのエラーを見たことがありますか?私の検索により https://github.com/expressjs/express/issues/3095

私はエクスプレスも使用しています:4.17.1

let COOKIE_OPTIONS = { httpOnly: true, sameSite: 'None', secure: true };
A cookie associated with a cross-site resource at http://MYURL.URL was set
without the `SameSite` attribute. A future release of Chrome will only deliver 
cookies with cross-site requests if they are set with `SameSite=None` and 
`Secure`. You can review cookies in developer tools under 
Application>Storage>Cookies and see more details at 
https://www.chromestatus.com/feature/5088147346030592 and 
https://www.chromestatus.com/feature/5633521622188032.

Insomia(Postman)を使用してリクエストを行うと、次のようになります

access_token=someToken; 
Path=/; 
HttpOnly; 
Secure; 
SameSite=None
6
Eric E

私の知る限り、これは将来のchromeの新しい実装に関する警告です

cookieのsamesiteオプション:Chrome 80以降、SameSite属性を指定しないcookieは、SameSite = Laxであるかのように扱われ、POST既存のサイトの移行を容易にするためのリクエスト。

その他の情報: https://www.chromium.org/updates/same-site

ウェブページをテストする場合は、この記事でChromeフラグをテスト用に設定する方法について説明します。ページが機能しなくなった場合は、すべてのリクエストを確認し、「http://」から「https://」への更新を確認するか、サードパーティのCookieを確認する必要があります