I'm using taint mode and would like to taint valid usernames and passwords. basically i'm not sure what to allow and what not to allow. Should passwords only allow alphabetical and numerical characters? or can a password be "This_is-my|pass,,word"
I don't see a reason to put any limitations on passwords, except disallowing characters that make it hard to input passwords, or to sling them around between functions. I'd forbid the NUL character "\x00", carriage return, "\cM" and linefeed, "\cJ".

As for usernames, it depends on what you are going to use them for. If it's purely used for authentication, there aren't many limits. If user names also need to be printed, you probably want to disallow unprintable characters, and maybe whitespace as well. Perhaps you want user names to be case insensitive, or perhaps you don't care to have a "carry", "Carry" and a "CARRY" on your system. What to allow and what not to allow for user names is something you should decide, and you should be guided by what you want to use (or plan to use) usernames for.


In reply to Re: Regex usernames and Passwords by Anonymous Monk
in thread Regex usernames and Passwords by tanger

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.