From a1579283a642a5fb43872bf505fff1da3f992017 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Tue, 14 Jan 2020 17:41:54 +0100 Subject: [PATCH] Add disabled option for cookie samesite attribute (#21472) Breaking change: If disabled the cookie samesite cookie attribute will not be set, but if none the attribute will be set and is a breaking change compared to before where none did not render the attribute. This was due to a known issue in Safari. Co-Authored-By: Arve Knudsen Co-Authored-By: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> Fixes #19847 --- CHANGELOG.md | 1 + conf/defaults.ini | 2 +- conf/sample.ini | 2 +- docs/sources/installation/configuration.md | 8 +++--- docs/sources/installation/upgrading.md | 11 ++++++++ docs/sources/reference/share_panel.md | 2 +- pkg/api/login.go | 7 +++-- pkg/api/login_test.go | 6 ++-- pkg/middleware/cookie.go | 18 ++++++------ pkg/middleware/middleware_test.go | 24 ++++++++++++---- pkg/setting/setting.go | 32 ++++++++++++++-------- 11 files changed, 75 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d54703eb3f1..02b4d7280a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ## Breaking changes * **PagerDuty**: Change `payload.custom_details` field in PagerDuty notification to be a JSON object instead of a string. +* **Security**: The `[security]` setting `cookie_samesite` configured to `none` now renders cookies with `SameSite=None` attribute compared to before where no `SameSite` attribute was added to cookies. To get the old behavior, use value `disabled` instead of `none`. Refer to [Upgrade Grafana](https://grafana.com/docs/grafana/latest/installation/upgrading/#upgrading-to-v6-6) for more information. # 6.5.2 (2019-12-11) diff --git a/conf/defaults.ini b/conf/defaults.ini index 2a7f9ab558e..07b0070b187 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -179,7 +179,7 @@ disable_brute_force_login_protection = false # set to true if you host Grafana behind HTTPS. default is false. cookie_secure = false -# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict" and "none" +# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict", "none" and "disabled" cookie_samesite = lax # set to true if you want to allow browsers to render Grafana in a ,