set samesite attribute to lax on all cookies to fix warnings

This commit is contained in:
byte[] 2020-05-26 17:37:49 -04:00
parent 781eda345c
commit 7b36f99c09
3 changed files with 4 additions and 3 deletions

View file

@ -45,7 +45,7 @@ function setFingerprintCookie() {
fingerprint = 'c1836832948'; fingerprint = 'c1836832948';
} }
document.cookie = `_ses=${fingerprint}; path=/`; document.cookie = `_ses=${fingerprint}; path=/; SameSite=Lax`;
} }
export { setFingerprintCookie }; export { setFingerprintCookie };

View file

@ -20,6 +20,6 @@ defmodule PhilomenaWeb.Channel.NsfwController do
# Duplicated from setting controller # Duplicated from setting controller
defp set_cookie(conn, cookie_name, value) do defp set_cookie(conn, cookie_name, value) do
# JS wants access; max-age is set to 25 years from now # JS wants access; max-age is set to 25 years from now
Conn.put_resp_cookie(conn, cookie_name, value, max_age: 788_923_800, http_only: false) Conn.put_resp_cookie(conn, cookie_name, value, max_age: 788_923_800, http_only: false, extra: "SameSite=Lax")
end end
end end

View file

@ -48,7 +48,8 @@ defmodule PhilomenaWeb.SettingController do
# JS wants access; max-age is set to 25 years from now # JS wants access; max-age is set to 25 years from now
Conn.put_resp_cookie(conn, cookie_name, to_string(params[param_name] == "true"), Conn.put_resp_cookie(conn, cookie_name, to_string(params[param_name] == "true"),
max_age: 788_923_800, max_age: 788_923_800,
http_only: false http_only: false,
extra: "SameSite=Lax"
) )
end end