Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Eliminate server-side state to obviate cookies

by hardburn (Abbot)
on Jul 05, 2005 at 16:55 UTC ( [id://472523]=note: print w/replies, xml ) Need Help??


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

This sounds horribly insecure to me. How do you stop the client from changing the state into one it shouldn't.

I think I'll keep cookies with a randomly-generated ID crossreferenced to a 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.

  • Comment on Re: Eliminate server-side state to obviate cookies

Replies are listed 'Best First'.
Re^2: Eliminate server-side state to obviate cookies
by tmoertel (Chaplain) on Jul 05, 2005 at 17:10 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

Re^2: Eliminate server-side state to obviate cookies
by Anonymous Monk on Jul 05, 2005 at 17:14 UTC
    How do you stop the client from changing the state into one it shouldn't.
    Encryption
    Storing the session state in the form sent back to the browser may have security implications if it reveals internal server information. In addition, the session state often contains sensible user input, like passwords. WASH/CGI addresses both concerns by providing a one-time pad encryption for the session state.

    20050705 Janitored by Corion: Moved (broken) link from a tag into [http://

      People who talk about using one-time pads in practice are generally either military or idiots.

      It takes a lot of work to generate (and in many cases to communicate) a one-time pad. Any reuse of data (or use of low-entropy random number generators) ruins the entire concept entirely, resulting in something that cryptographers assure me is easily broken. The required effort is fine for the military. But very few commercial applications find it feasible.

        resulting in something that cryptographers assure me is easily broken
        Yup. When you implement an OTP with a cyclic key, it's called a Vigenere Cipher. The attack looks at letter frequencies and their distributions within the ciphertext.

        thor

        Feel the white light, the light within
        Be your own disciple, fan the sparks of will
        For all of us waiting, your kingdom will come

      I get nervous whenever anyone mentions "one-time pad". In any case, I still can't imagine this having significant savings over coookie + session 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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-19 03:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found