mozilla / blurts-server

Mozilla Monitor arms you with tools to keep your personal information safe. Find out what hackers already know about you and learn how to stay a step ahead of them.
https://monitor.mozilla.org
Mozilla Public License 2.0
734 stars 206 forks source link

Missing FreshMenu logo #418

Closed pdehaan closed 6 years ago

pdehaan commented 6 years ago

https://fx-breach-alerts.herokuapp.com/scan (Searched test@example.com) https://fx-breach-alerts.herokuapp.com/?breach=FreshMenu

freshmenu

pdehaan commented 6 years ago

Actually, having little faith in my skills, I wrote a link checker which uses the latest breach data from HIBP [saved locally as ./breaches.json]:

const checkLinks = require("check-links");
const breaches = require("./breaches.json");

const SERVER = process.env.SERVER || "https://fx-breach-alerts.herokuapp.com";

async function main() {
  const links = breaches.map(breach => `${SERVER}/img/logos/${breach.Name}.${breach.LogoType}`);
  const results = await checkLinks(links, {
    timeout: 30000,
    retry: 1
  });

  Object.keys(results).forEach(uri => {
    const result = results[uri];
    if (result.statusCode !== 200) {
      console.error(`Error fetching ${uri}: status=${result.status} statusCode=${result.statusCode}`);
      process.exitCode = 1;
    }
  });
}

main();

Output:

Error fetching https://fx-breach-alerts.herokuapp.com/img/logos/FreshMenu.png: status=dead statusCode=404
Error fetching https://fx-breach-alerts.herokuapp.com/img/logos/KayoMoe.svg: status=dead statusCode=404
Error fetching https://fx-breach-alerts.herokuapp.com/img/logos/MailRu.svg: status=dead statusCode=404
Error fetching https://fx-breach-alerts.herokuapp.com/img/logos/NapsGear.png: status=dead statusCode=404
Error fetching https://fx-breach-alerts.herokuapp.com/img/logos/RussianAmerica.png: status=dead statusCode=404

UPDATE: Or, if you prefer JSON output:

const checkLinks = require("check-links");
const breaches = require("./breaches.json");

const SERVER = process.env.SERVER || "https://fx-breach-alerts.herokuapp.com";

async function main() {
  const links = breaches.map(breach => `${SERVER}/img/logos/${breach.Name}.${breach.LogoType}`);
  const results = await checkLinks(links, {timeout: 10000, retry: 1});

  const res = Object.entries(results)
    .filter(([uri, {status, statusCode}]) => statusCode !== 200)
    .reduce((data, [logo, {status, statusCode}]) => {
      const breach = logo.replace(/\/img\/logos\//, "/?breach=").replace(/^(.*)\.(.*?)$/, "$1");
      data.push({logo, breach, status, statusCode});
      return data;
    }, []);
  console.log(JSON.stringify(res, null, 2));
}

main();
[
  {
    "logo": "https://fx-breach-alerts.herokuapp.com/img/logos/FreshMenu.png",
    "breach": "https://fx-breach-alerts.herokuapp.com/?breach=FreshMenu",
    "status": "dead",
    "statusCode": 404
  },
  {
    "logo": "https://fx-breach-alerts.herokuapp.com/img/logos/KayoMoe.svg",
    "breach": "https://fx-breach-alerts.herokuapp.com/?breach=KayoMoe",
    "status": "dead",
    "statusCode": 404
  },
  {
    "logo": "https://fx-breach-alerts.herokuapp.com/img/logos/MailRu.svg",
    "breach": "https://fx-breach-alerts.herokuapp.com/?breach=MailRu",
    "status": "dead",
    "statusCode": 404
  },
  {
    "logo": "https://fx-breach-alerts.herokuapp.com/img/logos/NapsGear.png",
    "breach": "https://fx-breach-alerts.herokuapp.com/?breach=NapsGear",
    "status": "dead",
    "statusCode": 404
  },
  {
    "logo": "https://fx-breach-alerts.herokuapp.com/img/logos/RussianAmerica.png",
    "breach": "https://fx-breach-alerts.herokuapp.com/?breach=RussianAmerica",
    "status": "dead",
    "statusCode": 404
  }
]
lesleyjanenorton commented 6 years ago

added in #414

pdehaan commented 6 years ago

Looks good, now the only broken image is that MailRu one:

https://fx-breach-alerts.herokuapp.com/?breach=MailRu https://monitor.firefox.com/?breach=MailRu

$ node logo-checker.js

[
  {
    "logo": "https://fx-breach-alerts.herokuapp.com/img/logos/MailRu.svg",
    "breach": "https://fx-breach-alerts.herokuapp.com/?breach=MailRu",
    "status": "dead",
    "statusCode": 404
  }
]

Not sure if somebody has access to the server logs and can tell us what other assets may be 404ing on production.