php - Should i obscure database primary keys (id's) in application front end -


I am working on an application that allows a moderator to edit user information. Therefore, at the moment, I have a URL like

  http://xxx.xxx/user/1/edit http://xxx.xxx/user/2/edit  < / Pre> 

I'm a little worried here, because I am exposing the user table primary key (ID) directly from the database. I take URLs (eg: 1 and 2 urls) from URL, ask for databases with ID and get user information (of course, I encrypt the iPad ID from the URL).

Please note that

I am validating every request to check that the moderator has access to edit that user

I am doing this. is it safe? If not, how can I do it?

I can think of an option i.e. is a separate column for users with a key of 25 characters and use the keys in the URL and query data with those keys

But,

  • What does it matter? (Since the key is now exposed)
  • Inquiries by the primary key yield faster than other columns

    It is safe (and it seems to be the best way to do this) Unless the validity of admin rights is correct and you have prevented SQL injection. Both, about whom you mention it, I can say that you are good.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -