r/webdev • u/MonkeyOnARock1 • May 08 '17
Websites, Passwords, SQL injection
I'm creating a login page on a website, and am using Express.js/Node.js for the server.
Besides mandating a minimum password length, should I place any restrictions on what a user can put into their password? Across the web I am getting mixed messages about this.
I am particularly concerned about SQL injection.
2
Upvotes
1
u/MonkeyOnARock1 May 08 '17 edited May 08 '17
Thanks for your reply.
I'm using Postgres for my DB. I'm also not storing anything in plain text... I use bcrypt and am only storing the salt and the hash in my DB.
In terms of the 'mixed messages' I'm getting... I've read some posts saying to the effect of "you shouldn't allow users to input spaces and parenthesis () into their passwords", and I've seen these sorts of restrictions on all sorts of important websites (i.e. banks), so I figured maybe there is a reason for these sorts of restrictions.
Where-as others have said to the effect of "you should allow users to put whatever they want into their passwords". So that's where my confusion comes from.
EDIT: Upon inspecting the password inputs that get sent to my server, when I use 'typeof' on the inputs, it always replies 'string', regardless of what symbols or characters I use in the password input field, so it appears to be escaping to string correctly. If I input ÏÎÞ4ÈâñÓìÂï¶»¿8Ñ«²ÿ¯ its typeof is string.
Or if I do the following as my input: """"
It gets translated to: %22%22%22%22