Support » Plugin: Pixeline's Email Protector » Partly identical addresses may not be caught

  • Resolved pdaengeli

    (@pdaengeli)


    I found that addresses are not properly obfuscated and resolved when a partly identical, but shorter address is found first.

    To give two examples, the addresses foo@bar.co and foo@bar.com result in two links to foo@bar.co and the addresses bar@foo.co and foobar@foo.com both are displayed as bar@foo.co.

    As such cases are rare it might be enough to sort (usort) the expressions by length in the main/secondary function.

    https://wordpress.org/plugins/pixelines-email-protector/

Viewing 10 replies - 1 through 10 (of 10 total)
  • This is happening to me too. How did you fix it?

    I’m also having this issue… more with a foo@bar.com and barfoo@bar.com both showing up as foo@bar.com, but it’s the same issue.

    Unfortunately, I’m not of much help, but, if I find a resolution, I’ll try to post it here. Did either of you figure any way around this problem?

    I had tried to apply sorting by length, but it didn’t catch all the problems. I’d still like to have this working, but it’s not a show stopper for me.

    @pixeline, have you looked into this?

    Thanks for the quick response, @pdaengeli.
    I did manage to find the offending piece… it just does a search replace for the particular string, so, if you do sort from the longest to the shortest, I could see how that would work. Going to try it out on my end. Is there anywhere from which to fork this? I found a Git repo, but it’s empty.

    As far as I understand, you could contribute code modifications by opening a ticket in the TRAC repository of the plugin at https://plugins.trac.wordpress.org/browser/pixelines-email-protector/
    Let me know if you do so, I have a couple of problematic addresses, on which I could test your code.

    Since I couldn’t find a proper fix, I re-ordered the email listing in the content of the page so that barfoo@bar.com came before foo@bar.com in the page’s email links. That way the plug-in recognized them as different emails, but it’s not ideal since in my case foo@bar.com should come before barfoo@bar.com.

    Plugin Author pixeline

    (@pixeline)

    Hi!
    I would need to reproduce the issue to make sure I understand it fully. Can you send me a mail with a sample content that causes the problem?

    alexandre(replace these parentheses with @)pixeline.be

    Thanks!
    a.

    @pixeline,

    Thanks for the response.
    To get this problem to trigger, you actually need two similar address (one which is, effectively, a substring of the other).
    Just to continue using the same examples as above, if you were to have two email addresses on the same page:
    foo@bar.com
    barfoo@bar.com

    “foo@bar.com” would be turned into a mailto link in both cases, with the second email having the letters “boo” as just simple html to the left of the “foo@bar.com” mailto link.

    The simple suggestion @pdaengeli suggested, which I tested locally and seems to work great, is to sort all of the email addresses in the “pep_replace” function by string length.
    I added the following after the line declaring the “$the_addrs” array and before the “for” statement:
    usort( $the_addrs, function( $a, $b ){
    return strlen( $b ) – strlen( $a );
    });

    This way, as the pep_replace function cycles through emails to find a match, it looks for the longest match first, avoiding matching any substrings within a match.

    I’ll also drop a similar thing in TRAC repo. Thanks for the tip!

    Thank you, @mkranz, this works well.

    Plugin Author pixeline

    (@pixeline)

    Thanks @mkranz, I’ve used your suggestion to patch the plugin. It should trigger an update any time now.

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.