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
731 stars 206 forks source link

"The partial undefined could not be found" #1005

Closed groovecoder closed 5 years ago

groovecoder commented 5 years ago

STR:

  1. Go to https://fx-breach-alerts.herokuapp.com/breach-details/Vodafone

Expected results: breach detail page

Actual results: " Error

The partial undefined could not be found "

pdehaan commented 5 years ago

I don't see anything suspicious on HIBP: https://haveibeenpwned.com/api/v2/breach/Vodafone

Is this just because of the typo in "svg/glyphs/phsyical-addresses" fixed in https://github.com/mozilla/blurts-server/pull/1004/files#diff-2eae4f17c735a74201cb88127775e9daR104?

pdehaan commented 5 years ago

Also, https://fx-breach-alerts.herokuapp.com/breach-details/Bell

lesleyjanenorton commented 5 years ago

Fixed in #1004

pdehaan commented 5 years ago

I wrote a linter (but we may want to consider exporting a few more of these consts and functions so we can write some tests around them):

const priorityDataClasses = {
  "passwords": {
    weight: 100,
    pathToGlyph: "svg/glyphs/passwords",
    actions: "", // future functionality?
  },
  "bank-account-numbers": {
    weight: 99,
    pathToGlyph: "svg/glyphs/bank-account-numbers",
  },
  "credit-cards": {
    weight: 98,
    pathToGlyphs: "svg/glyphs/credit-cards",
  },
  "credit-card-cvv": {
    weight: 97,
    pathToGlyph: "svg/glyphs/credit-card-cvvs",
  },
  "partial-credit-card-data": {
    weight: 96,
    pathToGlyph: "svg/glyphs/partial-credit-card-data",
  },
  "ip-addresses": {
    weight: 95,
    pathToGlyph: "svg/glyphs/ip-addresses",
  },
  "historical-passwords": {
    weight: 94,
    pathToGlyph: "svg/glyphs/historical-passwords",
  },
  "security-questions-and-answers": {
    weight: 93,
    pathToGlyph: "svg/glyphs/security-questions-and-answers",
  },
  "phone-numbers": {
    weight: 92,
    pathToGlyph: "svg/glyphs/phone-numbers",
  },
  "email-addresses": {
    weight: 91,
    pathToGlyph: "svg/glyphs/email-addresses",
  },
  "dates-of-birth": {
    weight: 90,
    pathToGlyph: "svg/glyphs/dates-of-birth",
  },
  "pins": {
    weight: 89,
    pathToGlyph: "svg/glyphs/pins",
  },
  "phsyical-addresses": {
    weight: 88,
    pathToGlyph: "svg/glyphs/phsyical-addresses",
  },
};

Object.entries(priorityDataClasses).forEach(([key, value]) => {
  const glyphPath = path.join("views", "partials", `${value.pathToGlyph}.hbs`);
  const glyphExists = fs.existsSync(glyphPath);
  if (!glyphExists) {
    console.log("MISSING:", key, glyphPath);
  }
});

OUTPUT:

MISSING: credit-cards views/partials/undefined.hbs MISSING: phsyical-addresses views/partials/svg/glyphs/phsyical-addresses.hbs

I think the "undefined.hbs" issue is due to it being a plural "pathToGlyphs" instead of the singular "pathToGlyph" like the other priorityDataClasses.

pdehaan commented 5 years ago

Confirmed my linter passes w/ zero errors on the "add-ssn-icon" branch of #1004 PR. 👍

pdehaan commented 5 years ago

I'm a bit lost about what to do about this issue. The core problem is expertly fixed in #1004, but it feels like we should have a bit better 👣🔫 protection against typos and rendering an error page when a glyph is missing. Or even if the glyphs were SVGs and we just did a lazy loaded <img src="imgs/glyphs/${dataClass}.svg"> with a fallback image in case of a 404.

Not sure if adding some tests around this would help, but would have definitely failed a CI build earlier.

groovecoder commented 5 years ago

This has been fixed.