Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Storing credit card numbers temporarily (OT)

by phroggy (Monk)
on Aug 14, 2005 at 03:23 UTC ( [id://483652]=note: print w/replies, xml ) Need Help??


in reply to Storing credit card numbers temporarily (OT)

The way I see it, you've got three basic options:

  1. Store the credit card number server-side
  2. Store the credit card number client-side
  3. Use some combination of both

If you store it server-side, you can add it to an SQL table with an expiration time, and periodically DELETE FROM Table WHERE expiration<NOW(). Since it's important for security reasons that the information actually be deleted, I'd suggest doing this from an hourly (or more frequent if you'd like) cron job. Note that if the cron job runs immediately after the user clicks Preview, that's OK, because the expiration time will be some point in the future.

If you store it client side, you can either use a cookie (this strikes me as being a VERY BAD IDEA, because cookies are stored plain-text and will not be deleted immediately if the browser crashes or something), or you can a hidden form field, e.g. <input type="hidden" name="cc" value="nnnnnnnnnnnnnnnn">. Yes, this does mean that the value will be sent back to the client and they can see it if they view source, but as long as you're using SSL, I don't really see a major problem with this. Maybe add a Pragma: No-cache header or something, just to be sure.

In either case, you can obfuscate the number somehow, to make it non-obvious if anyone should stumble across it somehow.

Your third option would be to encrypt the number, store the encrypted form on the server as described in #1, and send the (randomly generated) decryption key to the client (via a hidden form field as described in #2). If someone hacks the server, the encrypted numbers are useless without the key, and if someone hacks the client, the key is useless by itself. I've never done something like this, but I'm sure someone else here has suggestions for implementations.

Although the cron job I suggested in #1 is still a good idea for #3, it wouldn't be absolutely required. I'd just add the delete query at the beginning of each script that accesses the database, so as long as the site is being actively used, old data is getting deleted periodically.

Do you actually have an official policy that says you won't store credit card numbers? Check the wording on that. How hard would it be to revise?

Personally, I'd recommend option #2.

perl -e '($,,@_)=("er",",\n","l Hack"," P","Just anoth"); print reverse @_;'

Replies are listed 'Best First'.
Re^2: Storing credit card numbers temporarily (OT)
by bradcathey (Prior) on Aug 14, 2005 at 11:54 UTC

    Points well taken, phroggy.

    Clarification: our privacy policy states that we will not "permanently" store their credit card number but that it will only be kept for the duration of the transaction.


    —Brad
    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Log In?
Username:
Password:

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

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

    No recent polls found