Skip to content

Commit

Permalink
Re-lax la portée des cookies (#371)
Browse files Browse the repository at this point in the history
Co-authored-by: Guillaume Grossetie <[email protected]>
  • Loading branch information
Thomas Parisot and ggrossetie authored May 2, 2021
1 parent 747664e commit 5d61c9e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions graphql/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ const secureCookie = process.env.HTTPS === 'true'
// When using 'strict' value, cookies will not be sent along with requests initiated by third-party websites.
// Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
const allowedOrigins = (origin ?? '').split(' ').filter(v => v).map(o => new RegExp('^' + o))
// Note that SameSite=none requires secure
const sameSiteCookies = allowedOrigins.length === 1 ? 'strict' : secureCookie ? 'none' : 'lax'
const sameSiteCookies = process.env.NODE_ENV === 'production' ? 'lax' : 'none'
if (sameSiteCookies === 'none') {
console.warn('Cookies are configured with `sameSite: none`.')
}
Expand Down

0 comments on commit 5d61c9e

Please sign in to comment.