diff --git a/CHANGELOG.md b/CHANGELOG.md index 963003564f..0b778aa1e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,12 +7,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [20.8.2] - Unreleased ### Added +- Set SameSite=strict for the session cookie to avoid CSRF [#2948](https://github.com/greenbone/gsa/pull/2948) + ### Changed - Use greenbone sensor as default scanner type when opening the dialog if available [#2867](https://github.com/greenbone/gsa/pull/2867) ### Fixed - Fixed setting whether to include related resources for new permissions [#2931](https://github.com/greenbone/gsa/pull/2891) - Fixed setting secret key in RADIUS dialog, backport from [#2891](https://github.com/greenbone/gsa/pull/2891), [#2915](https://github.com/greenbone/gsa/pull/2915) + ### Removed [20.8.2]: https://github.com/greenbone/gsa/compare/v20.8.1...gsa-20.08 diff --git a/gsad/src/gsad_http.c b/gsad/src/gsad_http.c index af54a3bf07..707ba795a3 100644 --- a/gsad/src/gsad_http.c +++ b/gsad/src/gsad_http.c @@ -516,9 +516,9 @@ remove_sid (http_response_t *response) * Tim Brown's suggested cookie included a domain attribute. How would * we get the domain in here? Maybe a --domain option. */ - value = - g_strdup_printf (SID_COOKIE_NAME "=0; expires=%s; path=/; %sHTTPonly", - expires, (is_use_secure_cookie () ? "secure; " : "")); + value = g_strdup_printf ( + SID_COOKIE_NAME "=0; expires=%s; path=/; %sHTTPonly; SameSite=strict", + expires, (is_use_secure_cookie () ? "secure; " : "")); ret = MHD_add_response_header (response, "Set-Cookie", value); g_free (value); return ret; @@ -592,8 +592,9 @@ attach_sid (http_response_t *response, const char *sid) * we get the domain in here? Maybe a --domain option. */ value = g_strdup_printf ( - SID_COOKIE_NAME "=%s; expires=%s; max-age=%d; path=/; %sHTTPonly", sid, - expires, timeout, (is_use_secure_cookie () ? "secure; " : "")); + SID_COOKIE_NAME + "=%s; expires=%s; max-age=%d; path=/; %sHTTPonly; SameSite=strict", + sid, expires, timeout, (is_use_secure_cookie () ? "secure; " : "")); ret = MHD_add_response_header (response, "Set-Cookie", value); g_free (value); return ret;