Skip to content

Commit c87805e

Browse files
FedericoCerattodom96
authored andcommitted
Improve cookie security
1 parent 5ee44f6 commit c87805e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/forum.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ routes:
10811081
formData["username"].body,
10821082
formData["password"].body
10831083
)
1084-
setCookie("sid", session)
1084+
setCookie("sid", session, httpOnly=true, sameSite=Strict, secure=true)
10851085
resp Http200, "{}", "application/json"
10861086
except ForumError as exc:
10871087
resp Http400, $(%exc.data), "application/json"
@@ -1109,7 +1109,7 @@ routes:
11091109
formData["email"].body
11101110
)
11111111
let session = executeLogin(c, username, password)
1112-
setCookie("sid", session)
1112+
setCookie("sid", session, httpOnly=true, sameSite=Strict, secure=true)
11131113
resp Http200, "{}", "application/json"
11141114
except ForumError as exc:
11151115
resp Http400, $(%exc.data), "application/json"

0 commit comments

Comments
 (0)