Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Eliminate server-side state to obviate cookies

by tmoertel (Chaplain)
on Jul 05, 2005 at 17:10 UTC ( #472526=note: print w/replies, xml ) Need Help??


in reply to Re: Eliminate server-side state to obviate cookies
in thread "omniscient debugging" for Perl

How do you stop the client from changing the state into one it shouldn't?
It's easy: cryptographically sign the state.
  • Comment on Re^2: Eliminate server-side state to obviate cookies

Replies are listed 'Best First'.
Re^3: Eliminate server-side state to obviate cookies
by hardburn (Abbot) on Jul 05, 2005 at 17:37 UTC

    Then you switch from needing to store a session ID in a database to needing to store and manage a private key. Not only that, but I can't imagine the ending size being less than the 160-bits needed for SHA1 (or 256 or 512 bits, if you want more secure hashes).

    I'll continue looking for a solution that's better than cookies + secure ID + database.

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

      Why do you think it is so difficult?

      All you need is a single secret on the server. Then you can compute a signature as the hash of the secret plus the outgoing state plus a random salt. The signature, salt, and state are emitted in the response. When a request comes in, verify its signature by comparing it to the hash of the server's secret plus the client's salt and state.

      Easy as pie.

      If you're paranoid, you can add timestamps, rotate secrets, and use public-key signatures, none of which makes the job much more difficult. And, even if you do consider it more difficult, why does it matter for the day-to-day web programmer? This stuff is part of the web-app framework and invisible to end programmers.

      Cheers,
      Tom

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://472526]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2022-12-08 23:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?