For example, Rails Restful Authentication uses
User.find_by_id(session[:user_id])
to find the user as the first try. So
- If the session is stored only by the use of cookies (isn't this a Rails option of storing session info all by using just cookies?), then can't user with user id 12345 changes his cookie's value from 12345 to 12346 and pretend to be another user?
as a side note
I. If the session is by a session_id as a cookie, and looked up session info in the DB, then can't another person steal the cookie and pretend to be that user? (steal the cookie by interception internet traffic)
II. Or, since the 3rd choice is to use the cookie auth_token
to check against the users table for the field remember_token
, can another person steal
this auth_token cookie and pretend to be that user?