20

Stack Exchange has Cloudflare's Email Address Obfuscation feature enabled, which replaces any email addresses it detects with the string [email protected], which is substituted for the actual email address with JavaScript a few moments after the page loads.

The script that Cloudflare injects to decode these email addresses currently lives at /cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js, but the gist of it is the following. As you can see, it's quite simple and given the prevalence of Cloudflare, I have no doubt that many of the folks that would still be scraping email addresses from the internet have already added it to their scripts.

const emails = [...document.querySelectorAll("[data-cfemail]")].map(element => {
    const obfuscated = element.dataset.cfemail;
    const digits = Array.from(
        {length: obfuscated.length / 2},
        (_, i) => parseInt(obfuscated.slice(i * 2, i * 2 + 2), 16)
    );
    const mask = digits[0];
    const characters = digits.slice(1).map(x => x ^ mask);
    return String.fromCodePoint(...characters);
});

This is not necessary. Email addresses are not public by default on Stack Exchange, so if a user posts it, it's because they want it to be discovered. I would like my email address to be visible to users without JavaScript. I would like my email address to be visible to search engines. I put it there because I want it to be visible, and I don't want it to be obfuscated.

The threat that this is protecting against is borderline-imaginary in 2024. I get a lot of spam, but almost all of it is semi-targeted based on where my email address has appeared in data leaks. It's not hard to venture into the dark corners of the internet and download lists of nearly a billion(!) leaked email addresses. Scraping the internet in the hopes of picking up a handful of email addresses here and there is rarely how these things are done, so this feature is not providing real value.

If anybody wants to follow this best practice of the 1990s, they can use one of the classic approaches to obfuscate their email addresses themselves. Don't force it on the rest of us.

To disable Email Address Obfuscation in the dashboard:

  1. Log into the Cloudflare dashboard ↗.
  2. Select your account and website.
  3. Go to Scrape Shield.
  4. For Email Address Obfuscation, switch the toggle to Off.
10
  • Is this just a chat thing or everywhere? I know for chat, trying to use SmokeDetector commands that involve posting email addresses causes issues due to the way SD monitors chat message content being affected by the email address obfuscation. It doesn't have the same issue with scanning posts because they're monitored using the API.
    – Spevacus Mod
    Commented Aug 28 at 15:49
  • I couldn't replicate this on the sandbox, and I thought profiles didn't show email. Could you tell us 'how' to replicate the issue? Commented Aug 28 at 15:50
  • @Spevacus I've noticed it in the "title" field of my profile, which I've been abusing as a prominent place to display my email address. I haven't checked where else it's being applied, but I assume everywhere, as I don't see any email_off comments in the page source. They could have defined rules to disable it for specific routes, but I'd assume that's not the case.
    – Jeremy
    Commented Aug 28 at 15:51
  • 1
    @JourneymanGeek stackoverflow.com/u/1114. Thanks for testing it in a post... that's interesting... maybe it is only enabled for profile page routes? I can confirm it applies to the About Me, Location, and Title profile fields, at least.
    – Jeremy
    Commented Aug 28 at 15:52
  • i.sstatic.net/656UJj7B.png no repro? Commented Aug 28 at 15:55
  • 3
    @JourneymanGeek Disable JavaScript, or do a hard reload and watch closely for the flicker. The obfuscation "is substituted for the actual email address with JavaScript a few moments after the page loads". I am frustrated because I want search engines to index my email address as an unique identifier for me, as a form of attribution/discoverability. (This isn't really a big deal, it's just been a minor annoyance that I decided to write down.)
    – Jeremy
    Commented Aug 28 at 15:56
  • 1
    Hm, I tried it and it seemed to try to hide it for just a moment. There's a bug here. Just not sure what the bug is :D Commented Aug 28 at 15:56
  • 1
    @JourneymanGeek I think the idea is cloudflare hides it before the page loads in your browser, then the script un-hides it a split second after the page loads. It's hidden in transit so page scrapers can't get the email. But as Jeremy mentioned here, the page scraper can just use cloudflare's javascript to de-obfuscate it. Commented Aug 28 at 16:12
  • Better request: get rid of that terrible CloudFlare, and switch to something better. Commented Aug 28 at 17:38
  • 5
    Note: This feature also affects SmokeDetector, causing some commands to fail when the command contains an email address (e.g., testing to see if an email address is caught). It's something we could work around, but have not done so, yet.
    – Makyen
    Commented Aug 28 at 19:35

0

You must log in to answer this question.

Browse other questions tagged .