Firefox 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.
Перейти к файлу
Besnik Bleta b41c2cebf9 Pontoon: Update Albanian (sq) localization of Firefox Monitor Website
Co-authored-by: Besnik Bleta <besnik@programeshqip.org>
2020-09-11 12:14:45 +00:00
.circleci Change docker log capture for integration_tests job. 2020-07-13 10:54:55 -05:00
__mocks__
controllers Remove Send from Bento 2020-08-27 15:18:21 -05:00
db add_signup_language_index migration 2020-08-10 14:51:42 -05:00
docs Revert "Merge pull request #1797 from mozilla/1789-join-the-party-experiment" 2020-08-26 12:15:32 -05:00
lib
locales Pontoon: Update Albanian (sq) localization of Firefox Monitor Website 2020-09-11 12:14:45 +00:00
public Fixed #1919 - Revised logic to use some() method 2020-08-28 15:27:29 -05:00
routes Restored /share routing functionality 2020-08-26 12:16:51 -05:00
scripts Merge branch 'email-experiment-breaches-script' of https://github.com/mozilla/blurts-server into email-experiment-breaches-script 2020-08-10 16:31:09 -05:00
template-helpers Update template-helpers/hbs-helpers.js 2020-08-26 14:13:21 -05:00
tests Update dependency eslint to v7 (#1852) 2020-08-04 11:38:54 -07:00
views Merge pull request #1869 from mozilla/1842-graduate-fxa-checkbox-tier-1 2020-08-28 10:42:01 -05:00
.dockerignore
.env-dist Add supportedLocales to package.json and version endpoint 2020-06-15 16:25:17 -07:00
.eslintignore
.eslintrc.js Update dependency eslint to v7 (#1852) 2020-08-04 11:38:54 -07:00
.gitignore
.htmllintrc
.npmignore
.stylelintrc
.travis.yml
CODE_OF_CONDUCT.md
Dockerfile
LICENSE
README.md
app-constants.js Update dependency dotenv to v8 (#1851) 2020-08-04 20:32:16 -07:00
basket.js
email-utils.js
hibp.js fix #1723: check old breach names for featured breach 2020-06-03 11:58:47 -05:00
l10n.toml
locale-utils.js Remove unused const 2020-07-02 13:57:29 -07:00
log.js
middleware.js Caught undefined error for users with no experiment session set 2020-08-26 13:38:34 -05:00
package-lock.json Update dependency express-handlebars to v5 (#1879) 2020-08-23 17:42:07 -07:00
package.json Update dependency express-handlebars to v5 (#1879) 2020-08-23 17:42:07 -07:00
renovate.json
scan-results.js Revert "Merge pull request #1797 from mozilla/1789-join-the-party-experiment" 2020-08-26 12:15:32 -05:00
server.js
sha1-utils.js

README.md

Firefox Monitor Server

Summary

Firefox Monitor notifies users when their credentials have been compromised in a data breach.

This code is for the monitor.firefox.com service & website.

Breach data is powered by haveibeenpwned.com.

See the Have I Been Pwned about page for the "what" and "why" of data breach alerts.

Development

Requirements

Install

  1. Clone and change to the directory:

    git clone https://github.com/mozilla/blurts-server.git
    cd blurts-server
    
  2. Install dependencies:

    npm install
    
  3. Copy the .env-dist file to .env:

    cp .env-dist .env
    

Run

  1. Run the server:

    npm start
    

Note: npm start uses onchange and nodemon to automatically detect file changes, re-compile static assets, and restart the express process. If you want more control, see the scripts section of package.json for more commands.

  1. Navigate to localhost:6060/

Database

To create the database tables ...

  1. Create the blurts database:

    createdb blurts
    createdb test-blurts # for tests
    
  2. Update the DATABASE_URL value in your .env file with your local db credentials:

    DATABASE_URL="postgres://<username>@localhost:<port>/blurts"
    
  3. Run the migrations:

    npm run db:migrate
    

Emails

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>

Firefox Accounts

Subscribe with a Firefox Account is controlled via the FXA_ENABLED environment variable. (See .env-dist)

The repo comes with a development FxA oauth app pre-configured in .env, which should work fine running the app on http://localhost:6060

To use a different Firefox Accounts oauth relying party, 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:

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"

Testing

The full test suite can be run via npm test.

Individual tests

To run individual tests, use NODE_ENV=tests and jest:

NODE_ENV=tests jest --runInBand tests/home.test.js

To run tests with interactive debugger lines enabled:

NODE_ENV=tests node inspect --harmony ./node_modules/.bin/jest tests/home.test.js

Lint

After installing the dependencies, you can lint the code by calling:

npm run lint

Deployment

Firefox Monitor Breach Alerts is designed with 12-factor methodology.

Deploy on Heroku

You will need to set some required environment variables on Heroku.

heroku config:set COOKIE_SECRET=unsafe-cookie-secret-for-heroku
heroku config:set DEBUG_DUMMY_SMTP=1

And any others, depending on the features you're running on Heroku - e.g., Email or Firefox Accounts.