Browse Source

Enforce referrer-policy in WebUI

This stops leaking private data to other websites via Referrer header.
adaptive-webui-19844
Chocobo1 6 years ago
parent
commit
7fd30fa90f
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 1
      src/base/http/types.h
  2. 4
      src/webui/webapplication.cpp

1
src/base/http/types.h

@ -52,6 +52,7 @@ namespace Http @@ -52,6 +52,7 @@ namespace Http
const char HEADER_HOST[] = "host";
const char HEADER_ORIGIN[] = "origin";
const char HEADER_REFERER[] = "referer";
const char HEADER_REFERRER_POLICY[] = "referrer-policy";
const char HEADER_SET_COOKIE[] = "set-cookie";
const char HEADER_X_CONTENT_TYPE_OPTIONS[] = "x-content-type-options";
const char HEADER_X_FORWARDED_HOST[] = "x-forwarded-host";

4
src/webui/webapplication.cpp

@ -570,9 +570,11 @@ Http::Response WebApplication::processRequest(const Http::Request &request, cons @@ -570,9 +570,11 @@ Http::Response WebApplication::processRequest(const Http::Request &request, cons
if (m_isHttpsEnabled) {
csp += QLatin1String(" upgrade-insecure-requests;");
}
header(Http::HEADER_CONTENT_SECURITY_POLICY, csp);
if (!m_isAltUIUsed)
header(Http::HEADER_REFERRER_POLICY, "same-origin");
return response();
}

Loading…
Cancel
Save