TwelvestoneProjects and Theory

Security - click this link to complete your registration


Sign in

  • Waiting for Godot ( 730 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 5.1 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.9 k posts )
    general front end design an...
  • Back End ( 9.7 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
dwadwee
 
2011-09-28

I'm struggling to google anything, and wondered if anyone here had any thoughts on this.

Users of this web app I'm making will have their user accounts created by someone else (you don't register yourself), and will be sent an email containing a link back into the site. They click this link and they can then set their own password, and from there they're in. So since you can therefore enter the site just by having access, or guessing, this link we send out, I'm wondering what the security implications might be.

I thought about creating a long string of random chars, unique in our database, that is added to a new account. This forms the URL that is sent. So they click that URL, they then have to enter the email address they're using and if the email matches the long code in the URL then I can let them in. There'd be a time limit on the code, if they haven't clicked it then it will time out after a month or so, and it's only good once.

Click here to activate your account and set your password: https://www.mywickedapp.com/activation/48rT23tfGDFRy433UY67gv48rT23tfGDFRy433UY67gv

It's not highly sensitive data here, just names and email addresses, and access to this web app - but without a personal relationship with the person that registers you, you can't do much with it. So there isn't much reason to want to hack in as far as I can see. But all the same I don't want to leave the door wide open as it were.

So a case-sensitive alpha-numberic 32 char string should be good enough for the link, right? Of course, I plucked "32" out of the air k

I think Stinky you did something similar for 12S, but I can't rem what the email looked like now.

Stickman
 
2011-09-28

What you've outlined is the approach I've taken with my own apps, so I'd say go for it.

A 32-char, case-sensitive alphanumeric string is way overboard through -- that's 62 ^ 32 which is an insanely huge number of combinations. 10 chars should be more than sufficient. Also, if you're storing it in a database make sure that the collation is case-sensitive -- anything ending '_ci' is case-insensitive (hence the suffix), you want something like utf8_bin.

dwadwee
 
2011-09-28

there's no cost to using 32 over 10 though is there? No significant storage space, nor calculation time really. Suppose I could say the same for 128 over 32 ...

There isn't a standard or reference for this sort of thing is there, that you're aware of?

Thanks for the collation headsup k

Stickman
 
2011-09-28

If you're not storing a large number of them then no, storage space isn't going to be an issue. It will affect speed but again, for low traffic it's not going to be noticeable. One potential issue is that a really long URL might wrap in some email clients, and stupid users will somehow miss off the last bit of the URL (when cutting+pasting rather than clicking).

Not sure what you mean by a 'standard reference' -- for which bit?

dwadwee
 
2011-09-28

well it's really cos the client was asking about what's a good length for this sort of thing, he was asking about whether there was a standard for it - I imagine there isn't.

Thanks for the input, Stick.

Stickman
 
2011-09-28

Well no, not that I'm aware of. For reference, goo.gl (the URL shortener) uses a 5-char case-insensitive string , which gives about a billion possible combinations. In the past I've used 8 chars, which gives a couple of trillion. 32 chars gives approximately 2 followed by 57 zeroes. I think the official term for that number is a 'metric crap-ton'.

dwadwee
 
2011-09-28

I'll include that in the spec k

Stinky
 
2011-09-28

All of that's fine, but I almost always just use the output of whatever hexdigest aglo I have sitting around. e.g. Digest::SHA1.hexdigest(user.id.to_s + rand() + Time.now.to_s) or some such thing.

It's overkill though.

mosquito
 
2011-09-28

Originally posted by Stickman

I think the official term for that number is a 'metric crap-ton'.

metric fuckton actually k

Stickman
 
2011-09-28

Sorry, I always get metric and imperial units mixed up.

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneProjects and Theory

Security - click this link to complete your registration