Mitigate CSRF using samesite for session cookie

This commit is contained in:
Zaid Abdulla committed 2019-06-05 00:17:36 -07:00
1 parent 4b1d2daafb
commit e7821f655b
1 file changed
+1 -1
+1 -1
View File
@@ -82,7 +82,7 @@ router.post("/login", async ctx => {
function success(roles, method): void {
log.method = method;
const token = jwt.sign({ username, roles }, JWT_SECRET);
ctx.cookies.set(JWT_COOKIE, token);
ctx.cookies.set(JWT_COOKIE, token, { sameSite: "lax" });
ctx.body = JSON.stringify(token);
logger.accessInfo(log);
}