Skip to content

Commit

Permalink
Merge pull request #2958 from greenbone/mergify/bp/gsa-21.04/pr-2948
Browse files Browse the repository at this point in the history
Avoid cross origin forgery by using same-site cookie (backport #2948)
  • Loading branch information
bjoernricks authored Jun 3, 2021
2 parents ddc17af + e2d597d commit 58acb69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Added
- Added @testing-library/user-event as a dev-dependency [#2891](https://github.com/greenbone/gsa/pull/2891)
- 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), [#2924](https://github.com/greenbone/gsa/pull/2924)
Expand All @@ -21,7 +22,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fixed missing name for CVE results on result detailspage [#2892](https://github.com/greenbone/gsa/pull/2892)
- Fixed setting secret key in RADIUS dialog [#2891](https://github.com/greenbone/gsa/pull/2891)
- Fixed setting result UUID in notes dialog [#2889](https://github.com/greenbone/gsa/pull/2889)

- 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
### Removed

[Unreleased]: https://github.com/greenbone/gsa/compare/v21.4.0...gsa-21.04
Expand Down
11 changes: 6 additions & 5 deletions gsad/src/gsad_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 58acb69

Please sign in to comment.