mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 22:47:21 -06:00
WebUI: Implement "Secure" flag for session cookie
Closes #11724. Option is enabled by default for users using qBittorrent's built-in HTTPS capabilities. This flag will never be set if qBittorrent is using plain HTTP. Users using HTTPS reverse proxies, like "qbt <-> (http) <-> proxy <-> (https) <-> user" should override the flag in the proxy in order to set it, if they wish to do so.
This commit is contained in:
@@ -337,6 +337,7 @@ void WebApplication::configure()
|
||||
|
||||
m_isClickjackingProtectionEnabled = pref->isWebUiClickjackingProtectionEnabled();
|
||||
m_isCSRFProtectionEnabled = pref->isWebUiCSRFProtectionEnabled();
|
||||
m_isSecureCookieEnabled = pref->isWebUiSecureCookieEnabled();
|
||||
m_isHostHeaderValidationEnabled = pref->isWebUIHostHeaderValidationEnabled();
|
||||
m_isHttpsEnabled = pref->isWebUiHttpsEnabled();
|
||||
|
||||
@@ -535,6 +536,7 @@ void WebApplication::sessionStart()
|
||||
|
||||
QNetworkCookie cookie(C_SID, m_currentSession->id().toUtf8());
|
||||
cookie.setHttpOnly(true);
|
||||
cookie.setSecure(m_isSecureCookieEnabled && m_isHttpsEnabled);
|
||||
cookie.setPath(QLatin1String("/"));
|
||||
QByteArray cookieRawForm = cookie.toRawForm();
|
||||
if (m_isCSRFProtectionEnabled)
|
||||
|
||||
Reference in New Issue
Block a user