Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Login and Session Thoughts

by Fastolfe (Vicar)
on Dec 04, 2000 at 19:24 UTC ( [id://44794]=note: print w/replies, xml ) Need Help??


in reply to Login and Session Thoughts

A username is just a session identifier that also contains useful information. Since it can be guessed so easily, though, you go on step further and supplement it with something extra, and a password works just as well.

This is also less secure than a random state ID, since the information is being passed in the clear over the 'Net, and cookies aren't generally treated as secure by most browsers. Generally it's better to authenticate the user relatively securely, pass back a reasonably un-guessable session ID, and use that for the duration of the session (expiring it after too much time has elapsed between visits). Associate that ID internally with the username.

I think this is just how "Everything" works (the codebase this site is built from). That doesn't mean it's approved by the higher-ups on the site or that they'd have done it that way if they had to choose.

Replies are listed 'Best First'.
(bbq) Re: Re: Login and Session Thoughts
by BBQ (Curate) on Dec 04, 2000 at 22:16 UTC
    I second Fastolfe's suggestion with one minor variation:

    Instead of setting one cookie witht the username + password, what I usually do is set two cookies with different expires. Username expires whenever you want, and password exprires at the end of the browser session. Unless it were a low security requirement site (such as perlmonks, we aren't exactly the NSA here :)) I would never keep the full combination of usernames and passwords on the cookie at the client.

    Its way too easy for someone to use the same computer later, inspect the cookies and use that information to impersonate the user. Just my US$0.02.

    #!/home/bbq/bin/perl
    # Trust no1!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2024-04-19 12:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found