Set samesite on cookies.

Set the SameSite attribute on all cookies issed to Lax.
This commit is contained in:
Robin Malley 2021-04-04 06:03:03 +00:00
parent 58565bc088
commit 33a23ef20c
1 changed files with 3 additions and 1 deletions

View File

@ -35,7 +35,9 @@ local function login_post(req)
local hash = sha3(todigest) local hash = sha3(todigest)
if hash == passhash then if hash == passhash then
local mysession = session.start(id) local mysession = session.start(id)
http_response_cookie(req,"session",mysession,"/",0,0) http_response_header(req,"set-cookie",string.format(
[[session=%s; SameSite=Lax; Path=/; Domain=test.monster; HttpOnly; Secure]],mysession
))
local loc = string.format("https://%s.%s",name,config.domain) local loc = string.format("https://%s.%s",name,config.domain)
http_response_header(req,"Location",loc) http_response_header(req,"Location",loc)
http_response(req,303,"") http_response(req,303,"")