Validators accepting null bytes (\x00)
Brian Beck <[email protected]>
| Newsgroups | gmane.comp.python.formencode |
|---|---|
| Message-ID | <[email protected]> |
(Do people still post here?)
Not sure if this has been discussed before, but I'm concerned about some of
the string validators accepting null bytes (the character \x00).
There's a nasty bug in Konqueror (I think it's a bug anyway) that adds null
bytes onto some field values after editing them. Since my only validation
was checking to make sure the .strip()ed strings were non-empty, null bytes
were accepted (strip() does not get 'em). As I found out, passing null
bytes along to the database is really, really bad. All values for that
column in any row were replaced with the null-byte-containing value. So all
that data was lost...
Is there any good reason to accept null bytes from form input, ever? If this
were a general validation framework, sure, but isn't this geared towards
just web forms?
right now NotEmpty.from_python('\x00') and String.from_pyton('\x00') return
'\x00'.
--
Brian Beck
Adventurer of the First Order
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642