add util.add_samesite_fields(response, value)

This function adds f"SameSite={value}" to each cookie's header
stored in response.

This is needed because starlette does not currently support
the `samesite` argument in Response.set_cookie. It is merged,
however, and waiting for next release.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-06-12 03:23:58 -07:00
parent ec632a7091
commit 91dc3efc75
6 changed files with 23 additions and 5 deletions

View file

@ -94,4 +94,4 @@ def render_template(request: Request,
secure=secure_cookies, httponly=True)
response.set_cookie("AURTZ", context.get("timezone"),
secure=secure_cookies, httponly=True)
return response
return util.add_samesite_fields(response, "strict")