In http://drupal.org/node/68265 there the validation function checks for header inclusion. Is it wise to add this to the Gotcha module?

Comments

NancyDru’s picture

Status: Active » Postponed (maintainer needs more info)

I don't really see the part you're talking about. I'm not sure I even understand the issue. Can you be more specific, please?

BTW, are you also "Creazion?"

PROMES’s picture

1.
I am talking about a contact form with file attachments, described in http://drupal.org/node/68265. The validation function is:
function contactform_validate($form_id, $form_values) {
// first we validate if there is a email injection
$finds = array("/bcc:/i",
"/Content-Type:/i",
"/Mime-Type:/i",
"/MIME-Version:/i",
"/multipart\/mixed/i",
"/boundary=/i",
"/subject:/i",
"/cc:/i",
"/to:/i");
foreach($form_values as $value)
foreach($finds as $find)
if(preg_match($find,$value))
form_set_error('', '

Stop spamming

');

I discovered yesterday that the code is converted now in the Mail Attach module where the validation module says:
// first we validate if there is an email injection
foreach($form_values as $field => $value){
if(preg_match('/(%0A|%0D|\n+|\r+|content-type:|to:|cc:|bcc:)/i', $value)){
form_set_error($field, variable_get('mailattach_spam_msg', 'Stop spamming'));
break;
}
}

So what I mean is: is it wise to add some code as above?

2.
No I don't have another alias in Drupal.org. I don't know "Creazion".

NancyDru’s picture

Status: Postponed (maintainer needs more info) » Postponed

When Spam 3.0 comes out and I have to make changes, I'll revisit this issue.