Firefox Breach Alerts notifies users when their credentials have possibly been leaked or stolen in a data breach. Powered by haveibeenpwned.com.
Communicates with the blurts-addon client-side add-on for Firefox Monitor.
See the Have I Been Pwned about page for the "what" and "why" of data breach alerts.
This project explores how Firefox - as the user agent - can support this.
See the Breach Alert Product Brief for more background, objectives, key use cases.
-
Clone and change to the directory:
git clone https://github.com/mozilla/blurts-server.git cd blurts-server
-
Install dependencies:
npm install
-
Copy the
.env-dist
file to.env
:cp .env-dist .env
-
Run the server:
npm start
-
Navigate to localhost:6060/
To create the test database tables, run the knex
migrations:
./node_modules/.bin/knex --knexfile db/knexfile.js migrate:latest
To populate the database with test data, use these scripts in scripts/
:
node scripts/load-breaches.js
loads breaches from HIBP into the databasenode scripts/add-breached-emails.js
adds some breached email records fortest[1-3]@test.com
users
Both scripts have --help
arguments for usage help.
The included .env-dist
sets DEBUG_DUMMY_SMTP=1
which disables emails.
To send emails, you'll need to unset DEBUG_DUMMY_SMTP
and supply real SMTP
config values for sending email.
You can set and source these via the .env
file, or set them directly:
export DEBUG_DUMMY_SMTP=
export SMTP_HOST=<your-smtp-host>
export SMTP_PORT=<your-smtp-port>
export SMTP_USERNAME=<your-username>
export SMTP_PASSWORD=<your-password>
To use Firefox Accounts, you'll need to create an FxA Oauth Client
and then set some OAUTH
config values.
You can set and source these via the .env
file, or set them directly:
OAUTH_CLIENT_ID=<your-fxa-oauth-client-id>
OAUTH_CLIENT_SECRET=<your-fxa-oauth-client-secret>
OAUTH_AUTHORIZATION_URI="https://oauth-stable.dev.lcip.org/v1/authorization"
OAUTH_PROFILE_URI="https://stable.dev.lcip.org/profile/v1/profile"
OAUTH_TOKEN_URI="https://oauth-stable.dev.lcip.org/v1/token"
This requires an enterprise subscriber API token from HIBP, which you will have
to get manually. Please ask a project admin if you need one. To download HIBP
breach hashsets, set a HIBP_API_TOKEN
environment variable. You can set and
source it via the .env
file, or set it directly:
export HIBP_API_TOKEN="<HIBP-API-TOKEN>"
With the HIBP_API_TOKEN
set, run the get-hashsets.js
script:
npm run scripts/get-hashsets.js
This will download the .zip
files into breach_hashsets/
directory.
After installing the dependencies, you can lint the code by calling:
npm run lint
Firefox Monitor Breach Alerts is designed with 12-factor methodology.
You will need to set required environment variables on Heroku.
heroku config:set COOKIE_SECRET=unsafe-cookie-secret-for-heroku
heroku config:set DEBUG_DUMMY_SMTP=1