- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Admin
[quote user="anonymous"]Don't forget to expire the token, as well.[/quote] He covered that: [quote]pre-used tokens fail[/quote][/quote]
Oh, I was thinking of re-usable ones. Single use are definitely more secure, though.
Addendum (2013-10-16 16:04):
Whoops, tag soup.
Anyways, before anyone points out that having re-usable tokens is a bad, bad idea, I hope that you all code in new applications and never inherit anything.
Admin
Sun did change the String.hashcode method in the early days of Java. The original implementation used only the first 10 characters of the string to determine the code. It came to light that this was a bad idea when someone as stowing URLs (just the string, not the java.net.URL) and most cached to the same value. Apparently many URLs begin "http://www"
Admin
http://msdn.microsoft.com/en-us/library/system.string.gethashcode.aspx
Does "inside an iframe" count as a different application domain? haha
Admin
I think we can conclude that it WASN'T collisions that caused the user ID's to be duped.
I think Jan was let go for spending too much time on tDWTF inventing WTFs.
Admin
Also, I would have thought: replaceAll("user=","user=" + user.hashCode());
whould end with user=<hashCode><user id>
that is, it would be 48627102 (assuming, of course that it started as user=102....
Admin
Admin
=> Any multiple of 2 (or adjacent value) = set of all real integers....
Admin
We had a similar accident in orkut team. Instead of actual user ids, some kind of hash was being produced, to make sure that Orkut Buyokokten, e.g., would not be exposed as User#1 (and Marissa, I believe, a User#3). The problem was, the produced hash code HAD TO BE non-negative, so the higher bit was being removed... except that the algorithm did not care.
So one nice weekend new people started getting old people's accounts. It was pretty cool; it took about a week to split all these new accounts (hundreds of thousands of them, I believe).
It was cultural. Google-cultural. Attempts to fix it BEFORE it happened bumped into Cool Senior Developers resistance - "we don't have time for these insignificant small improvements of yours".
Admin
Admin
I blame the cylons.
Admin
'Perfectly' is the correct adjective.
http://en.wikipedia.org/wiki/Perfect_hash_function
Admin
Admin
neat
Admin
It could be worse though. Worse would be using a tagged variable-width in-memory representation for all the fields so that every access to a value has to trawl over all the previous ones in the sequence, just so that the value can be accessed at all. (Bonus: pack things at the sub-byte level!) It does make some sense with strings — UTF-8 does this, but has other advantages that make it worth using— but for nearly anything else it is just such a poor decision. You really want something compressed? Use a separate compression step.
Admin
public int hashCode() { return String.valueOf(getId()).hashCode() % 32768; }
Problem solved! (for some meanings of solved).
Anyways, a system that stops working at 32768 users is 32 times better than a system that stops working at 100 users.
Admin
I'd like to think that the vendor was actually smarter and their "small ID" (only Anders mentions that his implementation has a limit of 32768, not that the vendor needed it at that limit) was fixed to allow larger values. So it was just Anders bug that was choking the system.
Also Jan was using a test account (hence ID 102). The main system might have started numbering at 10000000000 to not conflict with another legacy system that started at 1000000000. Companies like big numbers (e.g. browser versions being bumped every month instead of every year).
Admin
Admin
Admin
Admin
No Jan is the President's daughter.
No, Jan is Irish Girl.
Admin
I am pretty sure you're not missing something. There are a TON of other people moaning on about how collisions wouldn't happen who are though. They weren't sending a hash of the user id, they were sending a hash of the user id padded with the user id. There's a difference, kids.
Admin
FTFY
Admin
Admin
And that information should be in the documentation. So the WTF ought to be the lack of documentation on all sides.
Admin
No, TRWTF there is storing your data on someone else's machine.
Admin
Wrong Question. You certainly wanted to ask: What was the original programmer smoking?
Admin
Did you squish those 500 million numbers into 16 bits each? Didn't think so...
(What does VB do in case of overflow? Does it AND them with 65535 or does it clamp them to 32767?)
Admin
Maybe you meant 32767...
Admin
Admin
Hurray, now I can inhale--
oops, wrong Washington. Oh well.
Admin
Unless the URL was a template with ...&user=&... embedded in it precisely so the user ID could be filled in (rather than replacing one already there)?
Captcha: similis - a Virtual Disease?
Admin
DEFLNG A-Z
Admin
I've lost track of how many times I've heard this mistake made, and equally how many times I've complained loudly about it.
Admin
Admin
Admin
Admin
Admin
What do pants have to do with this?
Admin
Admin
This sounds familiar...
It has been too long since I submitted this WTF for me to repudiate any of the technical or personal attacks but the gist of the story is true.
I remember wondering how to decide which user actually got to keep the accidentally shared account on the external site if I was asked to fix the problem by implementing some sensible user id mapping mechanism.
And, yes, I am a dude :-)
Admin
Mike Hammer?