Browser security

Is it safe to store user user ID in cookie.why?

+4
source share
4 answers

Depending on what the identifier is used for.

If it is for authentication, it is a bad idea. I can change it to anything.

You better keep nonce, which is updated every so often (every page, if it does not crush your server). Then match this in your database with the authenticated user.

+2
source

Ok, just make sure you check in this cookie.

+1
source

If this is for any type of session management or used as a key to access confidential information (password, financial, medical, etc.), you do not want to store it in a cookie - of course, it doesn’t matter.

It is good practice to use a session cookie that is encrypted so that it is difficult to guess, checked based on a link to the internal server, it is often updated (whenever there is a change in security status, for example, switching from http to https pages) and is canceled when you exit or exit systems to prevent reuse.

+1
source

This is normal. But before you do anything important, ask the user password for verification.

-1
source

Source: https://habr.com/ru/post/1345492/


All Articles