I've heard people lecture here and there on the internet that it's best practice to obscure public facing database ids in web applications. I suppose they mainly mean in forms and in urls, but I've never read anything more than a mouthful on the subject.
EDIT: Of course, now that I ask this, I find some resources on the subject:
- https://stackoverflow.com/questions/2374538/obscuring-database-ids
- https://stackoverflow.com/questions/1895685/should-i-obscure-primary-key-values
- http://joshua.schachter.org/2007/01/autoincrement.html
These links satisfied some of my curiosity, but the SO posts don't have many votes and aren't necessarily centered around the topic in this context so I'm not sure what to make of it, and some of them claim that the third link is bogus. I'll leave the rest of my post intact:
I understand the differences between obscurity and security, as well as how the two can work together, but I can't imagine why this would be necessary.
Is there any truth to this, is it just paranoia, or is it just totally bogus altogether?
I can think of ways to do it, but of course it adds a lot of complexity to the application code. Under what circumstances would this be useful? If this is something people frequently do, how is it usually deployed? Hashing the identifiers? Something else? It seems like a lot of work for not much extra security. I'm not looking for real solutions, I just want to get an idea of how/why people would do this in the real world.
Is this really considered a "best practice" or is it merely a micro-optimization of little value?
NOTE: I think a few folks might have gotten the wrong idea: I'm not suggesting that difficult-to-guess ids would be the only security mechanism, obviously there would have be the usual access checks. Let's assume those are in place, and that simply knowing the id or hashed id of a record is not enough to grant access.