Getting this error for the .install file of a module I'm porting to D6:

Line 26: In SQL strings, Use db_query() placeholders in place of variables. This is a potential source of SQL injection attacks when the variable can come from user data. (Drupal Docs)

$ret[] = update_sql("INSERT INTO {sequences} VALUES ('{uc_payment_credit}_credit_id', $max)");

I don't particularly care for that syntax of putting variables in strings, but that aside coder should recognize that this query is being passed to update_sql() instead of db_query() and not advise you to use placeholders. : )

Reference: http://api.drupal.org/api/function/update_sql/6

CommentFileSizeAuthor
#3 coder_272903.patch1.66 KBstella

Comments

wim leers’s picture

I agree. The same problem exists in the Drupal 5 version of coder btw.

wim leers’s picture

I agree. The same problem exists in the Drupal 5 version of coder btw.

stella’s picture

Status: Active » Fixed
StatusFileSize
new1.66 KB

Try the attached patch. Should apply to both 5.x and 6.x versions.

Cheers,
Stella

wim leers’s picture

Status: Fixed » Needs review

I don't think this is committed yet? :)

stella’s picture

No it is committed. Can you double check that you've got the latest version? The check is done as part of the security set of tests, and not part of the sql ones. If it's still not working, can you provide the line of code for which the check is failing?

Cheers,
Stella

wim leers’s picture

Status: Needs review » Fixed

My bad :) Fixed indeed, thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.