Answer the question
In order to leave comments, you need to log in
Why is it unsafe to show the user ID in the URL, and how can I replace it?
Actually the essence of the question is this. There is, for example, a link to the user profile site.com/user/123, where 123 is the id in the database. Why is it unsafe to do so, and what identifier can be used instead of id-shnik ?
Answer the question
In order to leave comments, you need to log in
this facilitates attacks using mass assignment, as a friend recently unsubscribed , you can either replace it with a unique nickname (and then it also looks beautiful), or think about protection against attacks in advance.
Just give users id out of order.
Generation of 1 million tickets with random unique IDs
There is such a thing that it is not recommended to show real id on the client. In this case, another field is added, most often guid, and if some identifier needs to be shown on the client, then it is shown.
Example. vk.com. They shine the user id. And at the dawn of existence, it was possible to take this id to see a photo of any user.
It is important to use these ids thoughtfully.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question