pf » Turn off autocomplete for credit card input
Turn off autocomplete for credit card input
Memo to web developers building sites that accept credit card numbers:
Always, always set autocomplete="off" in the input tag. For example:
<input type="text" name="cc" autocomplete="off" />
Otherwise, if people have the form completion feature turned on their credit card number will be stored in plain text somewhere on the computer (in the registry, or elsewhere). This is especially dangerous if someone enters their credit card number from a public computer.
The only downside to using this attribute is that it is not standard (it works in IE and Mozilla browsers), and would cause XHTML validation to fail. I think this is a case where it's reasonable to break validation however.
I have been mentioning this to people a few years, but I just realized that I have never blogged about it.
add to del.icio.us
| Tags: html, security, form, autocomplete, credit cards
Related Entries
- Watch out for Autocomplete - June 7, 2006
- Amazon CTO on Security - June 10, 2006
- Recomendación para los formularios para tarjetas de créditos Tinta Fantasma
- Autocompletar y la informaci�n sensible Tranquilidad
Another way to make it so that auto-complete doesn't work, but that is still valid XHTML is to randomly generate part of the field name/id.
so for example:
name="creditcard12310093409" ... then you instruct your code to check for a form field with a name beginning in credit card. Since the likelihood of the field name being the same twice is pretty low, the credit card number should never appear in the field when auto complete is used.
If it's good enough for them...
Fortunately, there is an app which will disable the autocomplete flag for Mac Safari users:
http://magicpubs.com/mac/software/autocomplete/
So I think Mac users shouldnt purposely disable it cause they think we're only using it for security. Using your little open source program breaks my web application. The web developer didn't want autocomplete, so you shouldn't put it.
Sites which reject autofull, really do not help users, I think: if you do not presume to remember to a browser the password, you, more possibly, will use the easy password, or to place the sticky note concerning your monitor. How it does a banking online by more safe?
you can manually delete the autocomplete entries: 1) Press Alt+Down Arrow 2) Select the autocomplete entry to delete with your mouse or my pressing the Down Arrow key 3) Press the Delete key
onfocus='this.autocomplete=\"off\";'
First page ( HTML Form ) :
<form method="post"> <input type="hidden" name="username" value="random1"> <input type="hidden" name="password" value="random2"> Username: <input type="text" name="random1" value=""><br /> Password: <input type="password" name="random2" value=""> </form>
Where "random1" and "random2" are random names generated, you can use in combination with unix time.
Second page ( PHP output ) :
<?php
if ( isset($_POST['username'], $_POST['password']) && isset($_POST[$_POST['username']], $_POST[$_POST['password']]) ) { echo 'Username: '.$_POST[$_POST['username']].'<br />'. 'Password: '.$_POST[$_POST['password']]; }
?>
With this simple solution you will don't worry about autocomplete anymore in any browser.
elem.setAttribute("autocomplete","off");
This is because Firefox doesn't allow non-standard attributes to be set the short-hand way.
As for injecting it using JS to keep your sites standards compliant - that's just stupid. What's the point in making a standards compliant site, which javascript then messes up by injecting extra non-standard attributes? It would be more reliable and compatible, to simply hard-code the attribute into the HTML, then just ignore the validator warning.
window.onload = clearCC; </script>
try this code but i didn't check it. i just wrote it here :) .. any problem you may contact me at msn adn_ahsan(at)hotmail(dot)com .. I am web programmer if any of you need any solution just contact me.
Thanks
elem.setAttribute("autocomplete","off");
worked for FF 3.5 like a breeze :)
So, please, let the users decide. It's not your decision!
It's "embedded," sweetheart.
Also, don't use iFrames.
Also, girls don't code.
Also.
Unfortunately, browsers don't tend to let you turn on autocomplete *sometimes*. You turn it on or off. As a user, I would appreciate sites turning off autocomplete on fields relating to credit cards, for example. As a programmer, I would prefer to turn off autocomplete for the same fields to avoid problems. You cannot assume that users will even know how to turn off autocomplete in their browser. Just because someone is buying something online does not mean that they know ANYTHING about computers other than how to go to a web page and type their CC info.
In summary, I believe that there should be a standard for disabling browser autocomplete. It's not a usability nightmare as some people have mentioned. It's a security measure. If my credit card number isn't stored in my browser's autocomplete, that's not an inconvenience, it's a relief.
- J2EE Session Cookies on ColdFusion / JRun
- Hands on ColdFusion Security Training
- ColdFusion 9 Solr Vulnerability - Are you at Risk?
- FCKEditor Year 2010 Bug for Firefox 3.6
- jQuery UI Sortable Tutorial
- CFLogin Security Considerations
- Use varchar(max) instead of text in SQL Server
- ColdFusion SOAP Web Services and onRequestStart
RSS


Pete Freitag is a software engineer, and web developer located in











