posted 9 years ago
The best way to "secure a cookie" is not to use one at all. Keep the data server-side.
The second-best way is to only transmit it via SSL/TLS.
The jsessionid cookie is a special case, since it may exist before the user switched to secure communications (usually by logging in). In that particular case, the value of jsessionID is changed AFTER entering secure communications mode and the original jsessionid value becomes meaningless. Which is why webapps and server-side code should not play with the jsessionid themselves.
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer