Skip to content

Mntor 5363 - #6818

Open
GregHilstonMozilla wants to merge 5 commits into
mainfrom
mntor-5363
Open

Mntor 5363#6818
GregHilstonMozilla wants to merge 5 commits into
mainfrom
mntor-5363

Conversation

@GregHilstonMozilla

@GregHilstonMozilla GregHilstonMozilla commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

References:

Jira: MNTOR-5363

Description

We are going to be iterating on our openapi.yml contract, which is defined between the frontend and the backend for a breach integration. To achieve that with a thin and simple API, we'll be relying Remote Setting data that is already being pushed. That dataset requires two new pieces of infromation:

  1. More records. The sync previously only carried breaches that leaked passwords, so a breach that leaked a user's email but not their password would be invisible to Firefox and the privacy panel could never render it.
  2. A new field on each record. IsSensitive is a property straight from HIBP. The privacy panel must not surface a sensitive breach, and today no field tells it which ones those are. We flag rather than filter at the sync, because the credential manager is allowed to show them.

This PR modifies the periodic cron that pushes this data to include this.

How to test

npx vitest run src/scripts/cronjobs/updateBreachesInRemoteSettings/ src/utils/hibp.test.ts

Checklist (Definition of Done)

  • Localization strings (if needed) have been added. Not applicable, no user-facing strings.
  • Commits in this PR are minimal and have descriptive commit messages.
  • I've added or updated the relevant sections in readme and/or code comments. Block comments added to BreachDataTypes, ResolutionRelevantBreachDataTypes and HibpLabelByDataType, which sit together and were easy to confuse.
  • I've added a unit test to test for potential regressions of this bug.
  • If this PR implements a feature flag or experimentation, I've checked that it still works with the flag both on, and with the flag off. Not applicable.
  • If this PR implements a feature flag or experimentation, the Ship Behind Feature Flag status in Jira has been set. Not applicable.
  • Product Owner accepted the User Story (demo of functionality completed) or waived the privilege.
  • All acceptance criteria are met. The schema AC needs the Credential Management team, see above.
  • Jira ticket has been updated (if needed) to match changes made during the development process.
  • Jira ticket has been updated (if needed) with suggestions for QA when this PR is deployed to stage.

Follow Up Action

I believe we'll need another team to modify the Remote Settings schema and display fields, to declare IsSensitive as a property. I believe this can be done after this PR is merged, and likely by possibly Daniel's team?

@GregHilstonMozilla GregHilstonMozilla self-assigned this Aug 27, 2026
@GregHilstonMozilla
GregHilstonMozilla marked this pull request as ready for review August 27, 2026 20:00
PwnCount: breach.PwnCount,
AddedDate: breach.AddedDate,
DataClasses: breach.DataClasses,
// The panel hides these, the credential manager may not.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is where I'm adding the new property to the remote settings

breach.Domain !== "" &&
breach.DataClasses.includes("Passwords") &&
(breach.DataClasses.includes(HibpLabelByDataType.Passwords) ||
breach.DataClasses.includes(HibpLabelByDataType.Email)) &&

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is where we widen what we send to remote settings to include email data

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: What will happen if an older FF client receives data w/ this data class? Presumably just ignores the email ones? Or do older clients consume the OpenAPI spec?

@mansaj mansaj Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joeherm Older Firefox password-manager clients will ignore email-only records.

You can see it here: https://searchfox.org/firefox-main/source/browser/components/aboutlogins/LoginBreaches.sys.mjs

_breachInvolvedPasswords(breach) {
  return (
    breach.hasOwnProperty("DataClasses") &&
    breach.DataClasses.includes("Passwords")
  );
}

Extra fields like IsSensitive are ignored. DataClasses is already an unconstrained string array in the collection schema, so "Email addresses" is a new value, not a new shape.

@joeherm joeherm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code change LGTM- but left a question about the impact on older FF clients.

breach.Domain !== "" &&
breach.DataClasses.includes("Passwords") &&
(breach.DataClasses.includes(HibpLabelByDataType.Passwords) ||
breach.DataClasses.includes(HibpLabelByDataType.Email)) &&

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: What will happen if an older FF client receives data w/ this data class? Presumably just ignores the email ones? Or do older clients consume the OpenAPI spec?

HIBP spells data classes differently to us, and the difference is not
mechanical: pins is PINs, ip-addresses is IP addresses, and General is
ours alone.

Nothing in the codebase recorded that, and I found it confusing. I was
concerned that the next person needing it would write the naive transform
and be silently wrong for two of thirteen. The Omit makes a missing or
misspelled key a compile error.

Also documents what distinguishes the three data type lookups, which sit
next to each other and are VERY easy to confuse.
The type said keyof HibpBreachDataTypes, which is the keys of our own
lookup, but HIBP sends its own Title Case labels. What originally tripped
me up is t only ever compiled because "Passwords" is both a key and a
real label, and that was the only value any code compared against.

`string`` is used , and not something narrower because 163 distinct
labels appear across real breaches and we name only 12 of them. So a
narrower type would reject valid data.

The narrow type already exists a layer down on `HibpLikeDbBreach`, once
formatDataClass has converted at ingestion.

Both fields now carry a comment, since they share a name and differ
only in vocabulary. Which would have originally helped me.
fxmonitor-breaches is how Firefox learns a site was breached, and it
held password breaches only, so an email-only breach was invisible and
the privacy panel could never render it.

IsSensitive ships in the same change because the cron only POSTs records
it has not seen and never updates them, so a record that lands without
the flag never gets it.

Sensitive breaches stay in the collection on purpose: as the panel must
hide them, while the credential manager may not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants