Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation permits NUL bytes #372

Open
TheAndrey opened this issue Aug 3, 2023 · 1 comment
Open

Validation permits NUL bytes #372

TheAndrey opened this issue Aug 3, 2023 · 1 comment
Labels

Comments

@TheAndrey
Copy link

I accidentally discovered that the validation rules allow NUL bytes in the email address login.

As a result, I get an error from an SMTP server that doesn't like this address.

# exim4
501 NUL characters are not allowed in SMTP commands

# mailpit
451 4.3.5 Unable to process mail
[smtpd] error parsing message: malformed MIME header line: Received: from [127.0.0.1]

Code example

<?php

use Egulias\EmailValidator\EmailValidator;
use Egulias\EmailValidator\Validation\MultipleValidationWithAnd;
use Egulias\EmailValidator\Validation\NoRFCWarningsValidation;
use Egulias\EmailValidator\Validation\RFCValidation;

require_once './vendor/autoload.php';

$validator = new EmailValidator();
$rules = new MultipleValidationWithAnd([
	new RFCValidation(),
	new NoRFCWarningsValidation(),
]);

var_dump($validator->isValid(urldecode('exa%00mple%40domain.tld'), $rules)); // bool(true)
@egulias egulias added the bug label Sep 1, 2023
@egulias
Copy link
Owner

egulias commented Sep 1, 2023

Hey @TheAndrey
Thanks for reporting. Will take a look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants