Mitigate CSRF using samesite for session cookie
This commit is contained in:
1 parent
4b1d2daafb
commit
e7821f655b
1 file changed
+1
-1
@@ -82,7 +82,7 @@ router.post("/login", async ctx => {
|
|||||||
function success(roles, method): void {
|
function success(roles, method): void {
|
||||||
log.method = method;
|
log.method = method;
|
||||||
const token = jwt.sign({ username, roles }, JWT_SECRET);
|
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);
|
ctx.body = JSON.stringify(token);
|
||||||
logger.accessInfo(log);
|
logger.accessInfo(log);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user