Closed Bug 884607 Opened 13 years ago Closed 13 years ago

Categories

(Webmaker Graveyard :: Popcorn Maker, defect)

x86
macOS
defect
Not set
blocker

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: humph, Assigned: sedge)

References

Details

Attachments

(1 external file)

A user is complaining that this Popcorn make can't be opened. When I try to load it, I get an all white page. Curl shows that it's 404'ing with NoSuchKey in S3: $ curl -I https://QuytaroCreativeSpace.makes.org/popcorn/162l HTTP/1.1 404 Not Found Date: Tue, 18 Jun 2013 23:29:02 GMT Server: nginx/1.1.19 x-amz-error-code: NoSuchKey x-amz-error-detail-Key: quytarocreativespace/popcorn/162l x-amz-error-message: The specified key does not exist. x-amz-id-2: xFXzyGljujCnR2VM+OwTq4YHkKvsrf0xlChX7z1er3Q/8LSzHxaQftCGyGIIUw7J x-amz-request-id: 19051CD2FDA0EF0B Connection: keep-alive I did a test myself, and it works fine here. I asked the user to try and refresh their browser, no difference. Originally I thought this was the id vs. base36(id) bug, but it is actually a base36 string (162l last char is L). Is it possible this is related to a TitleCase username vs. all lowercase? That's all that I can see is different.
I think it has to be related to case somehow, as I note that when I enter: https://QuytaroCreativeSpace.makes.org/popcorn/162l in the URL, it gets turned into: https://quytarocreativespace.makes.org/popcorn/162l and in the headers: x-amz-error-code: NoSuchKey x-amz-error-detail-Key: quytarocreativespace/popcorn/162l Note the case there too.
Looks like we need to force lowercase all usernames. Would it be "bad" to just do it serverside and not tell the user at all?
CC'ing some folks so we can decide on a fix. Here is the issue and our options, as I see it: 1) DNS is case insensitive 2) S3 is case sensitive Currently, we can cope with brettgaylor but not BrettGaylor, and as we're finding, many users who do multi-word usernames want to use TitleCase. * We could force all usernames to be lowercase, internally and/or in the UI. * We could change our username validation stuff to treat brettgaylor and BrettGaylor as the same thing (that is, we'll allow you to use BrettGaylor, but we'll always lowercase it when we use it). Pomax points out that with respect to i18n, there are differences that matter with case. I would argue that this isn't our problem, since the entire web (vis-a-vis URLs) ignores case now. We need to solve this today, so let's get some consensus on how we'll sort it out. Also, Jon points to an interesting discussing of usernames (and case in usernames) at spotify's blog: http://labs.spotify.com/2013/06/18/creative-usernames/
In the absence of feedback, I'm going to suggest the following course. Please speak-up if you want it altered, otherwise I'm putting sedge on it today: You sign up for webmaker, and you enter BrettGaylor. In the login server, we switch it to "BrettGaylor".toLowerCase() (i.e., 'brettgaylor') and check if it's taken (i.e., a username already exists). If it doesn't, we store "BrettGaylor" in the Login DB's fullname field, and "brettgaylor" in the username field. Next, someone else tries to use brettGaylor, and someone else bReTtGaYlOr. If any of these, when converted to lower case, matches "brettgaylor" the username, we respond with "Sorry, there's only one Brett Gaylor!"--that is, we tell you it's taken. This will mean that we can safely store "BrettGaylor" (fullname) and "brettgaylor" (username) for the same person without a DB change (see https://github.com/mozilla/login.webmaker.org/blob/master/app/models/user/user.js#L42,L55), and show the fullname with TitleCase in UI, and use the lowercase username for any URLs, S3, etc. Thoughts?
This makes sense to me humph, especially after reading the spotify story. And it is expected behavior for other similar services.
This seems reasonable, but we should definitely figure out our story for unicode. If we're truly only allowing ASCII input, then we should also do that in this patch. We can always relax the unicode restrictions later.
IMO this is a sane approach in general. My one nit is which fields we use here. Ideally we'd have something like `username` for forward facing representation (BrettGaylor) and `cannon_username` for system use (brettgaylor). I understand that changing the user model isn't ideal however, so perhaps we could take a different approach. Previously we had a virtual getter returning "fullname" before "fullname" was a formal field in the model. Could we do the same with `username` or `cannon_username` and only store the username proper (BrettGaylor)?
To follow up: I'm trying to avoid using fullname for anything other than the user's actual name (or whatever /they/ choose to put there)
@jbuck: yes, we need to fix our validator, https://github.com/mozilla/login.webmaker.org/blob/master/app/models/user/user.js#L15. Doing [a-z] is locale/OS dependent, so we better tighten this for true ASCII only. Sedge, I'd confer with Pomax/Stackoverflow on this, as it's tricky to get bulletproof. @sedge: let's not change the model when we don't have to. We already have fullname and username. Username has come to mean just that, a system-level user name. The fullname field conveys "display"ness, so let's exploit that. We'll have to update front-end code to use fullname vs. username where it matters, and this can happen in a follow-up bug (e.g., make details page)
In addition, the user model was refactored two weeks ago to be an object with setters and getters according to OO principles. Changing the logic of the methods checking if a username is taken would be easy, and might negate any need for storing the username in two fields.
Assigning to sege now--let's start on this. Let's also get some tests in login that tickle these code paths, situations and check username vs. fullname.
@sedge, they chose what to type in the Claim form, so fullname *is* that.
Assignee: nobody → kieran.sedgwick
Status: NEW → ASSIGNED
Blocks: 884869
Blocks: 883255
Severity: normal → blocker
Sedge, lean on Pomax for anything you need with this. The Comms team wants to do their email blast by 3pm EDT, so we need to try and get this fixed before then if at all possible.
@humph: I'm still wondering if it wouldn't do better to modify the model logic to change `username`.toLowerCase() on the fly, and return it as a separate field to the server processes that need it (even though it won't be in the database). That way we can skip bug 883255 altogether, and not have to change `username` to `fullname` on the front end.
That sounds brittle to me. I'd rather we could trust what's in the DB without modification.
Yeah, I want to trust what's in the database too.
So one thing is that "Pomax points out that with respect to i18n, there are differences that matter with case. I would argue that this isn't our problem, since the entire web (vis-a-vis URLs) ignores case now." is not about upper vs. lower case, it's about "you can't just convert it and get what you expect". A turkish "I" (ascii capital i) has a lowercase i without a dot, so forcing things lowercase can simply generate the wrong string (i.e. "hey that's not my name, that's a completely different name, wtf?"). If we need a quick fix, for ascii-only, then we need to make people aware that his emphatically NOT their name, but a 1-20 character domain identifier. If we do want to create the impression that this is a real name, a lot of the validation we're doing right now becomes completely inadequate (people have names that are longer than 20 characters, and even in Canada there are hundreds of thousands of people with accents in their name that don't fit in ascii). So one thing I'd like answered here, too, is "what is this field, really?". Is it an ascii-webmaker id? if so, we need to surface that when people sign up, too, and tell them "pick something in ascii, of ... characters max". (a real solution cannot be done before the end of today. It's too complex)
We've gone back and forth on this before, and I think we've settled on the idea that this is your Webmaker username. It's not your name, for sure. And, we don't ever give you a chance to enter your name as such--just your username. So I think we're good without changing anything. We *could* rename fullname in the model to something else; but if we don't have to, let's not.
username is a DNS-friendly string. full stop. We use it for a bunch of other things, but that's what it needs to be. We can loosen restrictions later, but for now I'd like to have it be ASCII only.
right, so: naming becomes critical here. it's JUST a username, i.e. an alias that is in no way actually related to someone's real name?
because we have a "full name" field in the database right now, which we don't use, and using it would be weird because it doesn't represent the full name. We can use a different column name, but using name X to means role Y, we're setting us up for amazingly confusion (and possibly failure) later.
It's just a username, yes. I think renaming fullname to something else is probably safe (we need to confirm that nothing is actually using it, but I don't know of anything). So in sum: * "fullname" (or whatever you rename it to) is the verbatim, user-entered, validated (i.e., no spaces, non-ASCII), possibly TitleCased string entered in the claim form. * username is a canonical, DNS-friendly, lowercased "fullname" Neither is your real name, just as my wife doesn't call me `humph` :)
Also...in the interest of "today" vs. what we might do later, let's not rename `username` since it's now used all over the place.
also discussed this with Kieran, and in the interest of time we will use the fullname column, for this patch, with a follow-up bug to rename this column to its real name because it can't stay "fullname" if we don't use it for fullname. Bug for this: https://bugzilla.mozilla.org/show_bug.cgi?id=884917
Also in the interests of doing things today, lets not even touch fullname. fullname = username, like it is currently. We can loosen up restrictions and add a second input field later.
Attachment #764860 - Flags: review?(pomax) → review+
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
we weren't actually done with testing this yet. I tried this on staging with a user "SnakeEater" and the published url according to thimble is https://SnakeEater.mywebmaker.org/thimble/keep-calm-and-carry-on-5y, which resolves to https://snakeeater.mywebmaker.org/thimble/keep-calm-and-carry-on-5y when actually used in the browser. That URL then fails.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → RESOLVED
Closed: 13 years ago → 13 years ago
Resolution: --- → FIXED
Attachment mime type: text/plain → text/x-github-pull-request
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: