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

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