set SameSite to Lax on session cookies
authorJustin Wind <justin.wind+git@gmail.com>
Sat, 26 Feb 2022 22:01:08 +0000 (14:01 -0800)
committerJustin Wind <justin.wind+git@gmail.com>
Sat, 26 Feb 2022 22:01:08 +0000 (14:01 -0800)
lib/authenticator.js
lib/session-manager.js

index c388ee883c60bb0fa79380696b87b9894528d209..0c0c349b7288af20f0fc7df421c91aeddd61a3dc 100644 (file)
@@ -266,8 +266,9 @@ class Authenticator {
       const cookieParts = [
         sessionCookie,
         'HttpOnly',
-        `Path=${this.options.dingus.proxyPrefix}/`,
         `Max-Age=${this.cookieLifespan}`,
+        'SameSite=Lax',
+        `Path=${this.options.dingus.proxyPrefix}/`,
       ];
       if (this.options.authenticator.secureAuthOnly) {
         cookieParts.push('Secure');
@@ -282,6 +283,7 @@ class Authenticator {
         `${Enum.SessionCookie}=""`,
         'HttpOnly',
         'Max-Age=0',
+        'SameSite=Lax',
         `Path=${this.options.dingus.proxyPrefix}/`,
       ];
       if (this.options.authenticator.secureAuthOnly) {
@@ -385,4 +387,4 @@ class Authenticator {
 
 }
 
-module.exports = Authenticator;
\ No newline at end of file
+module.exports = Authenticator;
index a97a0e0fd3f0edf2ed897e89c9f565e41843525c..bd08eef26e7cc44d11473b53bfcd3a8a1e2f6e4f 100644 (file)
@@ -51,6 +51,7 @@ class SessionManager {
     const cookieParts = [
       `${cookieName}=${secureSession}`,
       'HttpOnly',
+      'SameSite=Lax',
     ];
     if (this.options.authenticator.secureAuthOnly) {
       cookieParts.push('Secure');
@@ -345,4 +346,4 @@ class SessionManager {
 
 }
 
-module.exports = SessionManager;
\ No newline at end of file
+module.exports = SessionManager;