Blame SOURCES/0006-Add-none-option-for-samesite.patch

4d4f51
From fb5ad7bf997946df4472cb94d7875ee70281d59c Mon Sep 17 00:00:00 2001
4d4f51
From: Anthony Critelli <acritelli@datto.com>
4d4f51
Date: Tue, 7 Jan 2020 11:14:24 -0500
4d4f51
Subject: [PATCH] Add none option for samesite
4d4f51
4d4f51
---
4d4f51
 README.md                 | 7 +++++--
4d4f51
 auth_mellon.h             | 3 ++-
4d4f51
 auth_mellon_config.c      | 2 ++
4d4f51
 auth_mellon_cookie.c      | 4 +++-
4d4f51
 auth_mellon_diagnostics.c | 1 +
4d4f51
 5 files changed, 13 insertions(+), 4 deletions(-)
4d4f51
4d4f51
diff --git a/README.md b/README.md
4d4f51
index be374bc..82a88fc 100644
4d4f51
--- a/README.md
4d4f51
+++ b/README.md
4d4f51
@@ -218,8 +218,11 @@ MellonDiagnosticsEnable Off
4d4f51
 
4d4f51
         # MellonCookieSameSite allows control over the SameSite value used
4d4f51
         # for the authentication cookie.
4d4f51
-        # The setting accepts values of "Strict" or "Lax"
4d4f51
-        # If not set, the SameSite attribute is not set on the cookie.
4d4f51
+        # The setting accepts values of "Strict", "Lax", or "None".
4d4f51
+        # When using none, you should set "MellonSecureCookie On" to prevent
4d4f51
+        # compatibility issues with newer browsers.
4d4f51
+        # If not set, the SameSite attribute is not set on the cookie. In newer
4d4f51
+        # browsers, this may cause SameSite to default to "Lax"
4d4f51
         # Default: not set
4d4f51
         # MellonCookieSameSite lax
4d4f51
 
4d4f51
diff --git a/auth_mellon.h b/auth_mellon.h
4d4f51
index 9ef2d8a..5f5a20b 100644
4d4f51
--- a/auth_mellon.h
4d4f51
+++ b/auth_mellon.h
4d4f51
@@ -164,7 +164,8 @@ typedef enum {
4d4f51
 typedef enum {
4d4f51
   am_samesite_default,
4d4f51
   am_samesite_lax,
4d4f51
-  am_samesite_strict
4d4f51
+  am_samesite_strict,
4d4f51
+  am_samesite_none,
4d4f51
 } am_samesite_t;
4d4f51
 
4d4f51
 typedef enum {
4d4f51
diff --git a/auth_mellon_config.c b/auth_mellon_config.c
4d4f51
index 7932e2d..f1a9d12 100644
4d4f51
--- a/auth_mellon_config.c
4d4f51
+++ b/auth_mellon_config.c
4d4f51
@@ -583,6 +583,8 @@ static const char *am_set_samesite_slot(cmd_parms *cmd,
4d4f51
         d->cookie_samesite = am_samesite_lax;
4d4f51
     } else if(!strcasecmp(arg, "strict")) {
4d4f51
         d->cookie_samesite = am_samesite_strict;
4d4f51
+    } else if(!strcasecmp(arg, "none")) {
4d4f51
+        d->cookie_samesite = am_samesite_none;
4d4f51
     } else {
4d4f51
         return "The MellonCookieSameSite parameter must be 'lax' or 'strict'";
4d4f51
     }
4d4f51
diff --git a/auth_mellon_cookie.c b/auth_mellon_cookie.c
4d4f51
index 8394c18..b2c8535 100644
4d4f51
--- a/auth_mellon_cookie.c
4d4f51
+++ b/auth_mellon_cookie.c
4d4f51
@@ -1,7 +1,7 @@
4d4f51
 /*
4d4f51
  *
4d4f51
  *   auth_mellon_cookie.c: an authentication apache module
4d4f51
- *   Copyright © 2003-2007 UNINETT (http://www.uninett.no/)
4d4f51
+ *   Copyright © 2003-2007 UNINETT (http://www.uninett.no/)
4d4f51
  *
4d4f51
  *   This program is free software; you can redistribute it and/or modify
4d4f51
  *   it under the terms of the GNU General Public License as published by
4d4f51
@@ -73,6 +73,8 @@ static const char *am_cookie_params(request_rec *r)
4d4f51
         cookie_samesite = "; SameSite=Lax";
4d4f51
     } else if (cfg->cookie_samesite == am_samesite_strict) {
4d4f51
         cookie_samesite = "; SameSite=Strict";
4d4f51
+    } else if (cfg->cookie_samesite == am_samesite_none) {
4d4f51
+        cookie_samesite = "; SameSite=None";
4d4f51
     }
4d4f51
 
4d4f51
     secure_cookie = cfg->secure;
4d4f51
diff --git a/auth_mellon_diagnostics.c b/auth_mellon_diagnostics.c
4d4f51
index 792e894..912814b 100644
4d4f51
--- a/auth_mellon_diagnostics.c
4d4f51
+++ b/auth_mellon_diagnostics.c
4d4f51
@@ -214,6 +214,7 @@ am_diag_samesite_str(request_rec *r, am_samesite_t samesite)
4d4f51
     case am_samesite_default: return "default";
4d4f51
     case am_samesite_lax:     return "lax";
4d4f51
     case am_samesite_strict:  return "strict";
4d4f51
+    case am_samesite_none:    return "none";
4d4f51
     default:
4d4f51
         return apr_psprintf(r->pool, "unknown (%d)", samesite);
4d4f51
     }
4d4f51
-- 
4d4f51
2.21.0
4d4f51