Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it secure to put the user id as a url parameter?

I am developing a social network and I would like to know if in the profile page of a user I could put the user id stored in database as a parameter in the url or is it a bad idea in terms of security?

I want the url to be bookmarkable. Should I put another thing instead of the user id?

like image 663
Aliuk Avatar asked Jul 24 '16 11:07

Aliuk


1 Answers

In terms of security there's no problem in putting the user id in a url. For example StackOverflow does it already: https://stackoverflow.com/users/3477044/aliuk

What's important is to verify that the currently authenticated user is allowed to access this url and take actions on its behalf.

like image 161
Darin Dimitrov Avatar answered Sep 30 '22 11:09

Darin Dimitrov