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
Email rule type hits when email addresses partially match #132
Comments
Hi @Digi92 Thank you very much for your issue and for reporting this bug! The solution I've added to the code could be better, you're right. I've tested your RegEx pattern, but more is needed to solve the problem. The problem is that I think the solution is this RegEx pattern:
This RegEx pattern would match at the start of the value or if a space is in front AND at the end of the value, or if a space is after the email address. If someone writes What do you think about that RegEx pattern? |
Hi @zepich, |
The logic of the rule tester for the email rule type also caught partial email addresses, which can lead to a problem if there is a rule item for spam@example.com but someone uses nospam@example.com. The rule type would match this. Since the email type is not a type with placeholders, it should not automatically match a part of an email address, so this fix corrects the wrong behavior.
Fixed with v1.0.1 |
Hi,
we noticed a submission today that was flagged via our email spam list.
The email type sees a hit apparently when the email addresses partially match.
In the EmailRuleTester "
mosparo/src/Rule/Tester/EmailRuleTester.php
Line 16 in 051def2
I think it would be better for mails to check if the mail is really present in the checked text, so either before/after the string is a space or the beginning/end of the string.
Our rule (mail modified):
{"uuid":"d9aee038-3098-4db4-8162-dfeb16794db8","type":"email","value“:“test@gmail.com“,“rating":1}
The email in the form (mail changed):
blatest@gmail.com
My solution suggestion would be to solve it via a regex:
if (preg_match('/\b' . preg_quote($itemValue, '/') . '\b/', $value)) {
Tested under version 0.4.6
The text was updated successfully, but these errors were encountered: