I read everywhere (and see in practice) that usernames should not be changeable. When I ask why, 'security' is given as a reason.
I've been searching for a definitive answer as to why changing a username is insecure, but I can't seem to find the answer.
Could any of the security experienced people here answer this question?
Note: if you do not know the answer, please refrain from speculation. I've thought of a number of reasons myself, but I don't know the actual answer, hence the question.
UPDATE:
1: By userId I meant to refer to some sort of unique identifier, be it a database record id or some other unique id. I've been told several times that changing the username is bad for security, even if the username is not the primary/unique identifier for the system itself.
2: I do allow users to change their 'public name'. This is the name that is used to identify the user to the other (non-privileged) users. for example:
userId: 1234
username: john02
public name: John Jameson
email: [email protected]
3: As pointed out by Jason and The Rook, consistency seems the only good reason. I've the feeling this 'best practice' might be a leftover from somewhere in the past when usernames where actually used within the system to uniquely identify users.
Without much difficulty, they can capture information from groups and websites you belong to, and possibly even access your browser history. Often this data also leads to your social networking sites, which gives them pretty much everything else they need, including clues to your passwords.
While there are some limited cases where having a secret username is a good idea, most of the time it has no real benefit. Usernames are not secrets and should not be treated as such. The only secret that matters for protecting your accounts online is the password (and multi-factor authentication, if you use it).
Why you need a unique username for every account. The main issue with usernames is that they are public, not hidden like your passwords. Reusing the same username makes it easier for malicious actors to build your online profile. It also makes it easier for advertisers and random people to find and track you online.
Passwords are case-sensitive to better protect your login information, while usernames are not. This means the system will recognize your username, regardless if there are capital letters or not. Passwords won't be recognize unless it is entered exactly as it was created.
If you don't allow people to change their usernames then some people are just going to create new accounts. I don't see any security risk in this, and many apps including SO allow you to change your name. If you change the name, keep the userid (primary key) the same so all of the data links up properly.
The only danger I see is if you can change your name to an account that already exists like 'admin'.
There are a number of reasons from a security aspect that you may not wish to allow users to change their names. However, as an all-out "NEVER do this" - I don't necessarily agree. But, allowing name changes creates quite a bit of extra work. If you are going to allow users to change their identities, you have to be very careful due to the reasons below.
Anyway, as I said - I don't believe it's necessarily a bad thing to allow users to change their names. However, it does create quite a bit more work for you, the developer. User names now can't be unique IDs in a database and user names now don't necessarily relate to someone (because they can be changed later), so you have to have a different system in place for expressing "uniqueness."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With