Connecting Tech Pros Worldwide Help | Site Map

How safe are cookies?

fjm fjm is offline
Needs Regular Fix
 
Join Date: May 2007
Location: California
Posts: 348
#1: Jun 24 '08
I need to direct users that are logged in to a sub domain. I guess the absolute only way is with a cookie to carry the session variable.

I have heard that using cookies opens the door to xss. Are cookies the best way to go? Security has to be put first on this project.

Any thoughts would be appriciated.

Thanks,

Frank
realin's Avatar
Familiar Sight
 
Join Date: Feb 2007
Posts: 252
#2: Jun 24 '08

re: How safe are cookies?


storing a session id, not very sure if it opens a loop hole or no
But for safety u can use an algorithm to secure ur session ID,
and concatenate a secret key with the session ID

Expand|Select|Wrap|Line Numbers
  1.  
  2. base64(sessionid+special character+secret key)
  3. and decode it when u have secret key 
  4.  
you can do lotsa stuff to secure the session id while it lies in cookie and delete it when its done :)
fjm fjm is offline
Needs Regular Fix
 
Join Date: May 2007
Location: California
Posts: 348
#3: Jun 25 '08

re: How safe are cookies?


Quote:

Originally Posted by realin

storing a session id, not very sure if it opens a loop hole or no
But for safety u can use an algorithm to secure ur session ID,
and concatenate a secret key with the session ID

Expand|Select|Wrap|Line Numbers
  1.  
  2. base64(sessionid+special character+secret key)
  3. and decode it when u have secret key 
  4.  
you can do lotsa stuff to secure the session id while it lies in cookie and delete it when its done :)

Hey Realin, thanks for the advice. I was able to find a little info googling. I have always avoided cookies because I never cared for them but now I find myself in a position where I need to use them.

Your example is exactly what I have done. Hopefully all will be ok. :)

Thanks!

Frank
realin's Avatar
Familiar Sight
 
Join Date: Feb 2007
Posts: 252
#4: Jun 26 '08

re: How safe are cookies?


its always great to see things getting worked :)
Reply