Last modified: 2013-08-28 23:57:56 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T41380, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 39380 - Set $wgSecureLogin = true; on Wikimedia wikis
Set $wgSecureLogin = true; on Wikimedia wikis
Status: RESOLVED FIXED
Product: Wikimedia
Classification: Unclassified
Site requests (Other open bugs)
unspecified
All All
: Normal enhancement with 2 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on: 40541 40679 42832
Blocks: ssl
  Show dependency treegraph
 
Reported: 2012-08-15 14:21 UTC by Tyler Romeo
Modified: 2013-08-28 23:57 UTC (History)
18 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Tyler Romeo 2012-08-15 14:21:44 UTC
With the exception of a few minor bugs (specifically email links), $wgSecureLogin functionality is for the most part complete. Is there any reason HTTPS login has not yet been enabled on enwiki?
Comment 1 Sam Reed (reedy) 2012-08-15 14:22:10 UTC
(In reply to comment #0)
> With the exception of a few minor bugs (specifically email links),
> $wgSecureLogin functionality is for the most part complete. Is there any reason
> HTTPS login has not yet been enabled on enwiki?

Why just enwiki?
Comment 2 Jarry1250 2012-08-15 14:23:34 UTC
I was under the impression that forcing https login is pointless if the user then browses on the insecure site - or am I wrong in that?
Comment 3 Chris Steipp 2012-08-15 14:40:56 UTC
@Jarry1250 If the login in is plaintext, then the attacker grabs the victims password and can login at any time (and try to attack other services using the same username and password). If the login is over ssl, and then a user browses in plaintext, the attacker can get the user's session and impersonate the victim, but can't re-login if the session goes away, and can't use the victims password on other sites.
Comment 4 Tyler Romeo 2012-08-15 15:17:43 UTC
(In reply to comment #1)
> (In reply to comment #0)
> > With the exception of a few minor bugs (specifically email links),
> > $wgSecureLogin functionality is for the most part complete. Is there any reason
> > HTTPS login has not yet been enabled on enwiki?
> 
> Why just enwiki?

Figured it was a good start. I'm totally open to just enabling it outright on all language Wikipedias (or even all wikis, if that's possible).
Comment 5 Jarry1250 2012-08-15 15:21:28 UTC
IIRC, ops wasn't deeply opposed to the idea of just switching the default to https for all pages, though that would be technically more difficult to get right, I think. Login forcing seems like a good start.
Comment 6 Helder 2012-08-22 00:13:48 UTC
See also bug 29898.
Comment 7 Tyler Romeo 2012-08-22 02:37:20 UTC
Do I need to make a Gerrit change for this? Or is there some other way we can move forward and do this?
Comment 8 Dereckson 2012-08-22 02:48:02 UTC
Indeed, a Gerrit change would be nice.
Comment 9 Tyler Romeo 2012-08-22 19:57:43 UTC
Kk, where exactly would I go about adding the option? If I'm correct, it's somewhere in operations/mediawiki-config (probably in the wmf-config directory), but I have no idea exactly where.
Comment 10 Alex Monk 2012-08-23 19:00:05 UTC
I would put it in wmf-config/CommonSettings.php
Comment 11 Tyler Romeo 2012-08-24 13:13:09 UTC
https://gerrit.wikimedia.org/r/21322
Comment 12 Dereckson 2012-08-24 15:03:42 UTC
Finally, do you want to enable it only on en.wiki or Wikimedia-wide?
Comment 13 Tyler Romeo 2012-08-24 15:26:04 UTC
I'm not sure. How does everybody else feel about it?
Comment 14 MZMcBride 2012-08-27 05:18:58 UTC
My thoughts on this are that:

(1) we shouldn't set $wgSecureLogin until there's a user preference for HTTPS (bug 29898) and a cookie to kick users from HTTP back to HTTPS); and

(2) we shouldn't set this per-wiki as it's a complete waste of time (we'll end up with a dozen bugs asking for individual wiki changes until someone finally just sets a default; let's just set the default reasonably from the start).

I'm strongly inclined to mark this bug as a duplicate of bug 29898. Is there any reason not to?
Comment 15 Dereckson 2012-08-27 07:54:26 UTC
The two bugs are two separate HTTP/HTTPS behaviors.

- bug #29898 offers the user to enforce every page is served in https://
- bug #39380 allows the user to browse in http:// but enforce login in https://
Comment 16 Tyler Romeo 2012-08-27 12:43:21 UTC
(In reply to comment #14)
> My thoughts on this are that:
> 
> (1) we shouldn't set $wgSecureLogin until there's a user preference for HTTPS
> (bug 29898) and a cookie to kick users from HTTP back to HTTPS); and

I strongly disagree with this. Right now all WMF wikis send all passwords in plaintext over insecure connections. That is a major security vulnerability and I'm surprised we haven't resolved it earlier. Yes, it would be better if EVERYTHING was over TLS, but this is the least we can do to start enforcing a better security policy.

> (2) we shouldn't set this per-wiki as it's a complete waste of time (we'll end
> up with a dozen bugs asking for individual wiki changes until someone finally
> just sets a default; let's just set the default reasonably from the start).

I'm totally up for enabling it for all wikis as the default. (In fact, my original patchset in Gerrit did just that by accident.) So that's fine with me as long as nobody else objects.
Comment 17 Dereckson 2012-08-27 20:06:39 UTC
I agree with Tyler we should enforce security.

Furthermore, this becomes a best practice: Google, Yahoo! use this https for login solution.
Comment 18 MZMcBride 2012-08-27 23:10:42 UTC
(In reply to comment #16)
> I strongly disagree with this. Right now all WMF wikis send all passwords in
> plaintext over insecure connections. That is a major security vulnerability and
> I'm surprised we haven't resolved it earlier.

All Wikimedia wikis send all passwords in plaintext? :-)  And to call this a major security vulnerability is a bit extreme as well.

But I agree with your general point about wanting a more secure user experience, which is why I'd rather see effort focused on fixing bug 29898.
Comment 19 Helder 2012-08-27 23:20:47 UTC
(In reply to comment #18)
> experience, which is why I'd rather see effort focused on fixing bug 29898.

But does this change require any other effort besides the change of an existing setting to true?
Comment 20 MZMcBride 2012-08-28 00:39:24 UTC
(In reply to comment #19)
> (In reply to comment #18)
>> experience, which is why I'd rather see effort focused on fixing bug 29898.
> 
> But does this change require any other effort besides the change of an existing
> setting to true?

Err, right. I think I remember what's going on here now. So there's $wgSecureLogin, which basically changes the "log in" link to specify HTTPS. The user clicks "log in" and he or she logs in to HTTPS and the user will stay in HTTPS after successfully logging in.

However, when the user clicks one of the million HTTP links (in an e-mail, on a wiki page, on IRC, elsewhere on the Web), the user will not be automagically redirected to HTTPS, he or she will _stay_ at HTTP and he or she won't be logged in any longer. This is very disorienting. The user can click "log in" in the corner of the page, but he or she will be transferred to Special:UserLogin over HTTPS and suddenly the user will appear to be logged in again.

In short, the issue with just setting $wgSecureLogin to true is that the user experience kind of sucks, as I understand it. (Feel free to correct me if I've misread the $wgSecureLogin-related code!)

(I'm also not sure it actually prevents form submission over HTTP [if the user navigates to the HTTP version of Special:UserLogin directly].)

If this is an acceptable situation, it's fine to set $wgSecureLogin to true on Wikimedia wikis. You'll need to get an okay from Wikimedia Foundation operations (ops) first before the change can be deployed. The load spike from logging in over HTTPS should be minimal, but the load spike from users continuing to use HTTPS after logging in will be less negligible, I think. Ops will also wants a heads-up so that there isn't an unexplained load spike.
Comment 21 Chris Steipp 2012-08-28 01:40:11 UTC
(In reply to comment #19)
> >> experience, which is why I'd rather see effort focused on fixing bug 29898.

I don't think they're mutually exclusive. We need to do both.


(In reply to comment #20)
> In short, the issue with just setting $wgSecureLogin to true is that the user
> experience kind of sucks, as I understand it. (Feel free to correct me if I've
> misread the $wgSecureLogin-related code!)

For any users that notice the protocol, it may be disorienting, but I would guess most of our users don't really pay attention to it (hopefully I'm wrong about that!). But the win is that if they click the login link again, they'll be back using https before they enter their password again. That would be a step towards helping our users be more secure, even if we have plenty of other bugs to close too.
Comment 22 MZMcBride 2012-08-28 02:14:21 UTC
I chatted with Ryan Lane briefly just now. There's no issue from ops' perspective to have logged-in users go over HTTPS. The current HTTPS infrastructure is over-provisioned and should be able to support logged-in users well.

However, Ryan agrees that the usability problem of currently not auto-redirecting from HTTP to HTTPS is rather nasty and he would also really like to see that addressed before this change is implemented.
Comment 23 Daniel Friesen 2012-08-28 02:48:32 UTC
(In reply to comment #21)
> (In reply to comment #20)
> > In short, the issue with just setting $wgSecureLogin to true is that the user
> > experience kind of sucks, as I understand it. (Feel free to correct me if I've
> > misread the $wgSecureLogin-related code!)
> 
> For any users that notice the protocol, it may be disorienting, but I would
> guess most of our users don't really pay attention to it (hopefully I'm wrong
> about that!). But the win is that if they click the login link again, they'll
> be back using https before they enter their password again. That would be a
> step towards helping our users be more secure, even if we have plenty of other
> bugs to close too.

The problem there though is when they hit the login link they already end up logged in. But now they are sitting on a login page, already logged in, and with no way to bypass it and get back to the page they want to edit.

- If they notice they are already logged in they probably won't bother trying to log in again and will be completely confused. Not to mention that forcing someone to login when already logged in is a really ugly experience.
- If they try to hit back they will return to http:// and be completely completely confused as they are no longer logged in.

I think there are a few things we may want to do to improve the user experience.

Firstly we should probably introduce a http cookie for users who log into https. Basically a cookie saying that a user is logged in on https. When we see this cookie on the http version of a page we should immediately redirect them to the https page. This won't be for security but rather to improve the user experience.

Secondly we should probably deal with Special:Userlogin's behaviour. The act of a user ending up on a login page when logged in is really strange.

There may be some value to logging in while already logged in. But I believe the primary reason for this is a holdover from login and user creation being part of the same page, needing to visit login to get to create user, and admins wanting to be able to create users while logged in. Just like with create user being the same link as login.

In the long run we want create user and userlogin to be separate pages. And removal of ever having a combined login+register link, always have separate ones.

Right now I think we may want to introduce a &loginlink=1 parameter like we have for &redlink=1. We'll place this on our login link. And when specified this will have the effect of automatically redirecting you to your final destination when you are already logged in.

Combined these two things will have the effect of:
- When you're already logged in and see a http:// link you will end up back on https:// so you are properly sitting in the place where you are logged in.
- When you end up on http:// and the http cookie has disappeared and got out of sync with https clicking on the login link will land you right back on the page you were at, in the https version, already logged in, and also fix your cookie.
Comment 24 Tyler Romeo 2012-08-28 03:32:37 UTC
(In reply to comment #20)
> (In reply to comment #19)
> > (In reply to comment #18)
> >> experience, which is why I'd rather see effort focused on fixing bug 29898.
> > 
> > But does this change require any other effort besides the change of an existing
> > setting to true?
> 
> Err, right. I think I remember what's going on here now. So there's
> $wgSecureLogin, which basically changes the "log in" link to specify HTTPS. The
> user clicks "log in" and he or she logs in to HTTPS and the user will stay in
> HTTPS after successfully logging in.
> 
> However, when the user clicks one of the million HTTP links (in an e-mail, on a
> wiki page, on IRC, elsewhere on the Web), the user will not be automagically
> redirected to HTTPS, he or she will _stay_ at HTTP and he or she won't be
> logged in any longer. This is very disorienting. The user can click "log in" in
> the corner of the page, but he or she will be transferred to Special:UserLogin
> over HTTPS and suddenly the user will appear to be logged in again.
> 
> In short, the issue with just setting $wgSecureLogin to true is that the user
> experience kind of sucks, as I understand it. (Feel free to correct me if I've
> misread the $wgSecureLogin-related code!)
> 
> (I'm also not sure it actually prevents form submission over HTTP [if the user
> navigates to the HTTP version of Special:UserLogin directly].)
> 
> If this is an acceptable situation, it's fine to set $wgSecureLogin to true on
> Wikimedia wikis. You'll need to get an okay from Wikimedia Foundation
> operations (ops) first before the change can be deployed. The load spike from
> logging in over HTTPS should be minimal, but the load spike from users
> continuing to use HTTPS after logging in will be less negligible, I think. Ops
> will also wants a heads-up so that there isn't an unexplained load spike.

This is how $wgSecureLogin works, but is not how it should work. If you notice, enablind $wgSecureLogin adds a "Stay on HTTPS" checkbox to the login form. The intended functionality of wgSecureLogin is that all logins are put over HTTPS, and then the user is given back to whatever they were using before. I just tested this on my test wiki and it doesn't seem to do this, so that's probably a bug, but that's what's supposed to happen.

So basically here is what needs to be fixed with $wgSecureLogin:
* Actual functionality is fixed
* HTTP cookie is set so user will be auto-redirected to HTTPS when logged in there.
* Links on the HTTPS login page should be set to the protocol of where the user is coming from (I forget where, but there is a bug filed for this).
Comment 25 Alex Monk 2013-03-06 16:50:28 UTC
(In reply to comment #11)
> https://gerrit.wikimedia.org/r/21322

Merged and deployed by Chris this morning.
Comment 26 Tyler Romeo 2013-03-06 16:55:43 UTC
https://gerrit.wikimedia.org/r/52344

Was reverted shortly afterward. :P
Comment 27 Chris Steipp 2013-03-06 17:57:32 UTC
We decided to revert at the end because unchecking the box to keep the user in https didn't redirect them to http when this was running on the cluster. We may want to enable this on a smaller set of wikis, or beta, so we can debug why that is happening.

In addition, I noticed that the centralauth_Session cookie is getting set with the secure flag. We may want to change that as well.
Comment 28 Tyler Romeo 2013-03-06 19:57:48 UTC
Yeah, I can't replicate the behavior on my test wiki, so maybe it's a configuration-specific bug?
Comment 29 Chris Steipp 2013-03-06 23:11:12 UTC
I *think* the issue is that since centralauth is injecting the SUL images, then successfulLogin() calls displaySuccessfulAction() instead of executeReturnTo(). So I would bet the "Return to..." link was to an http link, but the rest of the links on the page were https since the page was still loaded over https.
Comment 30 MZMcBride 2013-03-07 02:20:18 UTC
(In reply to comment #24)
> So basically here is what needs to be fixed with $wgSecureLogin:
> * Actual functionality is fixed
> * HTTP cookie is set so user will be auto-redirected to HTTPS when logged in
> there.
> * Links on the HTTPS login page should be set to the protocol of where the
> user is coming from (I forget where, but there is a bug filed for this).

Did all of this happen before this got merged/deployed? :-/

And I think a fourth point might be "get rid of the Special:UserLogin checkbox" (if that's not already included in the three points above). It's pretty bad user interface, I think. The default should just be sane.
Comment 31 Tyler Romeo 2013-03-07 17:57:14 UTC
(In reply to comment #30)
> And I think a fourth point might be "get rid of the Special:UserLogin
> checkbox"
> (if that's not already included in the three points above). It's pretty bad
> user interface, I think. The default should just be sane.

Yeah, but what if the user wants to stay in HTTPS rather than go back to HTTP. Without the checkbox they no longer have an option to do so.
Comment 32 MZMcBride 2013-03-07 18:20:38 UTC
(In reply to comment #31)
> Yeah, but what if the user wants to stay in HTTPS rather than go back to
> HTTP. Without the checkbox they no longer have an option to do so.

Logged-in users should be routed via HTTPS to Special:UserLogin and then stay there for however long they're logged in. A user preference (inside Special:Preferences) _may_ make sense to allow logged-in users to switch to HTTP, but the default should be HTTPS from login to logout. There's no need to have a checkbox on Special:UserLogin.
Comment 33 Tyler Romeo 2013-03-07 18:45:15 UTC
(In reply to comment #32)
> Logged-in users should be routed via HTTPS to Special:UserLogin and then stay
> there for however long they're logged in. A user preference (inside
> Special:Preferences) _may_ make sense to allow logged-in users to switch to
> HTTP, but the default should be HTTPS from login to logout. There's no need
> to
> have a checkbox on Special:UserLogin.

But why? There's no purpose to forcing all logged in users to be over HTTPS. It's not like they're transmitting sensitive information when editing Wikipedia.
Comment 34 Steven Walling 2013-03-07 18:56:59 UTC
(In reply to comment #33)
> (In reply to comment #32)
> > Logged-in users should be routed via HTTPS to Special:UserLogin and then stay
> > there for however long they're logged in. A user preference (inside
> > Special:Preferences) _may_ make sense to allow logged-in users to switch to
> > HTTP, but the default should be HTTPS from login to logout. There's no need
> > to
> > have a checkbox on Special:UserLogin.
> 
> But why? There's no purpose to forcing all logged in users to be over HTTPS.
> It's not like they're transmitting sensitive information when editing
> Wikipedia.

You're assuming that all Wikipedia editors live in countries and do editing tasks that they would be comfortable transmitting to the public. That's not the case. Put yourself in the shoes of someone editing from Qatar or Beijing, and ask whether it would be a good thing to automatically direct such users to HTTPS. 

For people not subject to that kind of extreme case... many would feel more comfortable about the security of their account and the privacy of their information if they were logged in from a secure connection. If we can add this enhancement for people, we should.
Comment 35 Tyler Romeo 2013-03-07 19:39:42 UTC
(In reply to comment #34)
> You're assuming that all Wikipedia editors live in countries and do editing
> tasks that they would be comfortable transmitting to the public. That's not
> the
> case. Put yourself in the shoes of someone editing from Qatar or Beijing, and
> ask whether it would be a good thing to automatically direct such users to
> HTTPS. 
> 
> For people not subject to that kind of extreme case... many would feel more
> comfortable about the security of their account and the privacy of their
> information if they were logged in from a secure connection. If we can add
> this
> enhancement for people, we should.

If we're talking about extreme cases here, then what about the extreme (or maybe not-so-extreme) case of other wikis who don't have the resources to put their users over HTTPS, but they still want to make sure their users' passwords are secure?

If https://gerrit.wikimedia.org/r/47089 is merged, then there will also be the technical ability to require HTTPS for all logged in users, but I think that we should keep the scope of $wgSecureLogin specific to what it was originally intended for: making logins secure.
Comment 36 MZMcBride 2013-03-07 21:28:09 UTC
(In reply to comment #35)
> If https://gerrit.wikimedia.org/r/47089 is merged, then there will also be
> the technical ability to require HTTPS for all logged in users, but I think
> that we should keep the scope of $wgSecureLogin specific to what it was
> originally intended for: making logins secure.

I agree with keeping $wgSecureLogin within scope. For this bug, however, would you mind changing the bug summary from "Set $wgSecureLogin = true; on Wikimedia wikis" to something that captures what I think we really want here: setting $wgSecureLogin in addition to providing HTTPS by default for logged-in users?

HTTPS prevents session exposure. It's obviously not critical to have, but it's a reasonable enhancement request that's been tested and provisioned for and it prevents users from accidentally shooting themselves in the foot.

If other sites want to only secure login, but put users back into HTTP for everything else, that's certainly their prerogative. For Wikimedia wikis (the scope of this bug), I think we must secure logins in addition to automatically redirecting users back to HTTPS by default.
Comment 37 Tyler Romeo 2013-03-08 00:31:39 UTC
(In reply to comment #36)
> I agree with keeping $wgSecureLogin within scope. For this bug, however,
> would
> you mind changing the bug summary from "Set $wgSecureLogin = true; on
> Wikimedia
> wikis" to something that captures what I think we really want here: setting
> $wgSecureLogin in addition to providing HTTPS by default for logged-in users?

But this requires development, which would take time. The reason I filed this bug is that (with the exception of the bug that occurs because of extensions), $wgSecureLogin is functional and only requires setting a configuration variable to true in order to enable. Personally I'd like to see all logged in users over HTTPS as well, but at the very least we could make some attempt at improving security in the meantime.
Comment 38 Platonides 2013-04-29 17:36:51 UTC
(In reply to comment #24)
> So basically here is what needs to be fixed with $wgSecureLogin:
> * Actual functionality is fixed

> * Links on the HTTPS login page should be set to the protocol of where the
> user is coming from (I forget where, but there is a bug filed for this).

> * HTTP cookie is set so user will be auto-redirected to HTTPS when logged in
> there.
This could be done by simply enabling Strict transport security.
Comment 39 Tyler Romeo 2013-04-29 17:39:48 UTC
(In reply to comment #38)
> (In reply to comment #24)
> > So basically here is what needs to be fixed with $wgSecureLogin:
> > * Actual functionality is fixed
> 
> > * Links on the HTTPS login page should be set to the protocol of where the
> > user is coming from (I forget where, but there is a bug filed for this).
> 
> > * HTTP cookie is set so user will be auto-redirected to HTTPS when logged in
> > there.
> This could be done by simply enabling Strict transport security.

I did this in Extension:SecureSessions. However, I should note that the third problem has already been fixed with the forceHTTPS cookie and the second problem can't be solved with STS.
Comment 40 Gerrit Notification Bot 2013-06-16 03:54:33 UTC
Related URL: https://gerrit.wikimedia.org/r/68937 (Gerrit Change I17c902ae8d5e6845c938f7d6643b3d469d6e9a57)
Comment 41 Tyler Romeo 2013-06-16 03:56:51 UTC
Well, there's take two. Once the bug-fix for CentralAuth is live we can try this out again.
Comment 42 Gerrit Notification Bot 2013-07-08 22:11:57 UTC
Change 68937 had a related patch set uploaded by Krinkle:
Enabling secure login (HTTPS), second attempt

https://gerrit.wikimedia.org/r/68937
Comment 43 Gerrit Notification Bot 2013-07-17 21:19:56 UTC
Change 68937 abandoned by Ryan Lane:
Enabling secure login (HTTPS), second attempt

Reason:
Handled in change 74268 in the correct place.

https://gerrit.wikimedia.org/r/68937
Comment 44 Gerrit Notification Bot 2013-08-28 20:08:34 UTC
Change 81563 had a related patch set uploaded by CSteipp:
Secure login to true for all wikis

https://gerrit.wikimedia.org/r/81563
Comment 45 Gerrit Notification Bot 2013-08-28 20:11:19 UTC
Change 81563 merged by jenkins-bot:
Secure login to true for all wikis

https://gerrit.wikimedia.org/r/81563

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links