Sign In  |  Cart  |  Join Now

built-in block form textfields don't validate!

January 30, 2010
Status: In Progress
Priority: Medium

How important is this to you?

Very
Somewhat
Not important
Please Login to Vote
If you make a block and don't override the save method, textfield input is not escaped before being used in the database query to insert/update the record! Just add any basic block -- html, image, youtube, whatever -- and put an apostrophe in the title field (or the main content area for the html block), submit the form -- if you have php errors being displayed it will show that the SQL query failed.

I know this is in the admin section so hopefully the site owners and maintainers aren't trying to run SQL injection attacks on their own sites, but escaping all input before using it in a query should always be performed regardless.

Minor clarification: title should be "textfields aren't escaped"

Jan 31, 2010 at 10:12 PM
Just realized that "don't validate" is not an accurate description of this -- it's that the values of the textfield aren't escaped before being passed to the database query. Sorry for the confusion.
 

Describe

Feb 01, 2010 at 12:09 PM
Can you describe the version, environment, and steps taken to reproduce this? I've never seen this before and I'm sure it wouldve come up before now. For example I just tried adding an HTML block with an apostrophe in it to a page and there was no issue/error/escaping, nothing.
 

It's with save() method only

Feb 02, 2010 at 1:53 AM
What jodanlev is talking about is when a block doesn't clean up the input it might cause an issue.
For example, if you use the basic_test block and simply type in a ' it will give an error.
Screenshot attached (test on latest svn).
 

Ah. Content _starting_ with an apostrophe.

Feb 02, 2010 at 2:08 AM
Got it.
 

Beginning or ending with apostrophe

Feb 02, 2010 at 11:23 AM
Interesting -- I guess I jumped the gun a little bit. It's actually only if an apostrophe is in the beginning or the end of the text, not if it's in the middle. Weird.
 

Yeah

Feb 02, 2010 at 12:01 PM
This must be something to do with ADODB or our implementation of it. I'll check it out. Thanks.
 
 

Hot Spots...

ForumsPartners | Contact | Blog

Search site