-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebUI: append port to session cookie name #21619
base: master
Are you sure you want to change the base?
Conversation
In this case from my side this PR can be closed. |
It would be really nice to fix the multi-instance scenario for users without requiring them to manually configure a custom cookie name. I suspect most users are not aware of this footgun, and so having a comprehensive fix will also prevent these users from opening GitHub issues unnecessarily. |
m_sessionCookieName = DEFAULT_SESSION_COOKIE_NAME; | ||
m_sessionCookieName = DEFAULT_SESSION_COOKIE_NAME + QString::number(m_webUiPort); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative would be to come up with a unique cookie name on startup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, the current method looks better, since it still identifies the cookie name with a specific qBittorrent instance, so that some client with a smarter implementation than browsers (which is why the problem is) could even send it to a specific instance and not to everyone on the same host.
It's reasonable. |
Yes, I think having this would eliminate the need for setting a custom cookie name. |
This comment was marked as resolved.
This comment was marked as resolved.
Btw, chances are high, that other web applications name their session cookie also as |
This is a good point. This PR switches the static portion of the name to |
@@ -179,7 +179,7 @@ WebApplication::WebApplication(IApplication *app, QObject *parent) | |||
LogMsg(tr("Unacceptable session cookie name is specified: '%1'. Default one is used.") | |||
.arg(m_sessionCookieName), Log::WARNING); | |||
} | |||
m_sessionCookieName = DEFAULT_SESSION_COOKIE_NAME; | |||
m_sessionCookieName = DEFAULT_SESSION_COOKIE_NAME + QString::number(m_webUiPort); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_sessionCookieName = DEFAULT_SESSION_COOKIE_NAME + QString::number(m_webUiPort); | |
m_sessionCookieName = DEFAULT_SESSION_COOKIE_NAME + QString::number(Preferences::instance()->getWebUIPort()); |
Prevents overwriting the shared cookie between qBt sessions on the same host.
Separated from #21618. Original topic: #20873 (comment)