4 ms·
What I think we need is a standard for documenting password requirements and restrictions on the password entry page itself, in a format that is easily parsed a
by tzs 10y ago
What I think we need is a standard for documenting password requirements and restrictions on the password entry page itself, in a format that is easily parsed and understood by software.
Password managers that have browser integration could then use this to generate passwords acceptable to the site.
For password managers without browser integration, I bookmarklet could be developed that extracts the password format information and makes it available in a form that can be copy/pasted to the password manager, which could then remember it along with the other data for the site.
There are at least three ways that seem reasonable that could be used to convey the necessary information.
1. Make use of already defined attributes of the <input type="password"> field. In particular, there are three existing attributes that are very relevant:
• minlength: the minimum allowed length of input,
• maxlength: the maximum allowed length of input,
• pattern: a regular expression that the password must match.
By using lookahead matching in the regular expression, you can express rules like "must have at least one upper case English letter, one lower case English letter, one digit, and one special character chosen from @!#$%^&()". For example, pattern="(?=.[A-Z])(?=.[a-z])(?=.[0-9])(?=.[@!#$%^&()])".
A downside to this is that expressing the rules as a regular expression does not make it easy for a program like a password manager to understand it. It makes it easy for a password manager to apply it to a give password, but that isn't super helpful when it comes to generating a new password.
So that argues for some other way to convent this information, bringing us to...
2. Add a new attribute to some tag to convey this information. In HTML5, it is legal (as in doing so does not make the HTML invalid) to add custom tags if their name starts with "data-". A "data-format" tag could be added to the password input field, with its value being in some industry agreed upon format.
In prior versions of HTML, doing that would break HTML in the sense that it would not conform to the DTD. Not many programs actually care if what they are given as HTML conforms to the DTD, but those can be kept happy be a slight change to the DOCTYPE declaration.
Usually the DOCTYPE declaration just contains references to external documents that contain the definitions that actually make up the DTD for the document. You can also put DTD definitions right inside the DOCTYPE declaration. To make our new data-format attribute legal, all we need to do is append the appropriate definition in the DOCTYPE after the list of external references.
- tacostakohashi 10y agoYou think that sites that are unable to come up with sensible password rules will be able to get this right, on a large enough scale to make it useful? In terms of the metadata, you've more or less covered it, but the only way it has a hope of being useful is if it's provided by some community-minded third party.
- tzs 10y agoThe person coding the webpage usually isn't the person who made the stupid password rules, so if putting in this metadata was considered industry best practice I think there is a decent chance it could become widespread.