So is there a need for a TRULY idempotent equivalent of XMPP's nodeprep? Or one that handles more Unicode points? Or is it a calculated decision to support Unicode 3.2 points only? (Sorry for the nooby questions, but this was very interesting and I don't know a lot about Unicode)
The decision to only support Unicode 3.2 is simply because the StringPrep framework [1] (which XMPP's nodeprep and various other protocols use) is forever tied to that version of Unicode. Current work is on the PRECIS framework [2] which uses the metadata for Unicode code points to determine how to handle them during canonicalization instead of relying on a hard coded set of mapping tables. There's still a lot of wor…
Creative usernames and Spotify account hijacking
61–70 of 83 posts
Re: Creative usernames and Spotify account hijacking
#62Earlier quoted context omitted.
I'm not sure how they can avoid storing both. They need to store the verbatim username in order to know how to display the username in the UI. They need to store the canonical username in order to efficiently know whether a given canonical username is in use.
Not necessarily, in PostgreSQL you could simply add a canonicalised index.
But - when the issue here is the question of the reliability of the implementation of the canonicalisation function, having it done once in python, and then again by PG is going to be a huge issue.
Re: Creative usernames and Spotify account hijacking
#63I don't see any real reason to rely on idempotence. They could simply store two names: One is provided by the user (verbatim), and the second is its reduction to lowercase letters and digits (canonical). For all internal logic, they could use only the canonical name, and use the verbatim name in the front-end to make the user happy. > Lower casing has the key property of being idempotent, i.e., that applying it more…
Canocialisation functions are, by definition , idempotent. Their canocialisation function, which is a standard one, was broken by subtle changes in Python 2.5, but worked previously.
Well, in general, modular code should not make assumptions about other parts of the program (when possible).
You know, if the function is idempotent by definiiton, it does not mean that its implementation is. Unicode is changing too, new symbols are added.
Re: Creative usernames and Spotify account hijacking
#64This seems odd. I mean, if their code was properly modular , they would have just one place where they "fetchUserIdByName(userName)", which returns one user ID or null if it's not used yet. When a new user is created, it then gets assigned a unique user ID. The email address is assigned to that user ID. Then, if they do a password reset on user = "bigbird", it should do the exact same lookup to find the email address…
What you're talking about has nothing to do with modularity. You're thinking of DRY. They having nothing to do with each other. DRY tells us the code for looking up a user id by user name should be written in only one place, not that the code should be called from only one place. The mistake was assuming the name->name function was idempotent, because it wasn't. You are right to suggest using a name->id function inst…
They having nothing to do with each other.
DRY tells us the code for looking up a user id by user
name should be written in only one place, not that the
code should be called from only one place.
If you write 'canonicalize(username)' in eight different places, you are not being DRY. If you need to write 'canonicalize(username)' in eight different places, your code probably doesn't separate responsibilities properly across separate modules.As such, they have a lot to do with each other. After all, if you call code from more than one place, you are writing the calling code in more than one place. Lack of DRYness is about the fact that you are doing so. Lack af modularity is about why you need to do so.
Re: Creative usernames and Spotify account hijacking
#65"In this case the two users who posted to the forum where actually rewarded with some Spotify premium months."
I'd say: Premium lifetime memberships would be better :)
Re: Creative usernames and Spotify account hijacking
#66So if a username gets passed from service to service and you want to make sure it is in canonical form you can safely apply .lower() and if it was already in canonical form there is no harm done, and it is easy to stay safe. Why? Suppose you only pass the original name around instead. Then you don't require your canonicalization function to be idempotent, which might be good in your case since it wasn't.
Re: Creative usernames and Spotify account hijacking
#67I think they could have handled the 'reward' a bit better :P "In this case the two users who posted to the forum where actually rewarded with some Spotify premium months." I'd say: Premium lifetime memberships would be better :)
Re: Creative usernames and Spotify account hijacking
#68Earlier quoted context omitted.
Why does HTML have a and a tag?
is emphasis/semantic and is visual/style.
Re: Creative usernames and Spotify account hijacking
#69Earlier quoted context omitted.
As they say in the article, they are trying to serve a global audience. As is easily googlable, Spotify was developed in the Baltic; the developer's own names likely contain non-ASCII characters.
Interesting, I felt foolish about an hour after having written this post, realizing that in most scenarios, it really shouldn't ever be any amount of effort minus half a second of planning and felt foolish for writing off unicode. (Normally I go the other route, unicode all the things). I suppose I feel that I was probably right to call myself arrogant then, to find out what you noted about Spotify's creators/creatio…
Re: Creative usernames and Spotify account hijacking
#70I have seen also much worse solutions. Where actually giving username, logs you in (sets logged in session cookie) and then prompts for password. When you enter invalid password you're logged out. If you give username, and then change url, you're in. Business as usual. When you test it, it works. Username + right password = ok, Username + wrong password != ok. Tests passed, and that's it.