Giter Club home page Giter Club logo

jelban-js's Introduction

jelBAN.js

Mutation testing badge Known Vulnerabilities codecov npm

A library for filtering fake, disposable and duplicated email addresses.

TLDR; See Usage And Wiki.

Features

  • Filters and checks for disposable email addresses from temporary email services (like 10minutemail and Mohmal), see the full list of domains at lib/validators/temporary-email-domains.
  • Filters and checks for aliases that lead to the same email box from providers like Gmail.
  • Filters for emails within an allowed domain list, or that are not in an excluded domain list.

Supported Providers

Gmail

Jelban's Gmail provider normalizes Gmail addresses to lowercase, non dotted and non aliased @gmail.com email addresses, since:

  1. Gmail addresses are not case sensitive, [email protected] is equivalent to [email protected].

  2. Gmail offers an aliases feature where you can create multiple aliases for your address, example:

    For example, messages sent to the following aliases will all go to [email protected]:

    janedoe+school@gmail.com janedoe+notes@gmail.com janedoe+important.emails@gmail.com

  3. Also, @gmail.com addresses, can be reached by using @googlemail.com, source http://techcrunch.com/2010/05/03/gmail-uk/. So [email protected] is exactly equivalent to [email protected].

  4. Dots don't matter in Gmail addressees (source), so [email protected], and [email protected], and [email protected] and [email protected] are all similar.

Outlook/Hotmail

Similarly to the previous provider, Jelban's Outlook provider normalizers Outlook (aka. Hotmail) email addresses as it has also the option to create aliases (src), example:

Emails to jane.doe+school@hotmail.fr and jane.doe+work@hotmail.fr will land at [email protected]'s mailbox

Security and privacy concerns

Issue #1

If you rely on the email normalization feature of this library you might be making account enumeration and brute force attacks easier. As attackers will have to guess for only a small subset of strings that does not have dots, upper/lowercase characters or aliases.

Also, users may choose to use the aliases when registering to your applications, and that a choice that must be respected as they may route that kind of emails to certain folders in their mailboxes.

Possible solution

Store email addresses in both formats, the user input and your normalized format, and when checking if an address is used you can rely on the normalized one, this may cause another issue if a user wants to change from their address [email protected] to [email protected] in their profile settings, then you know best what to do :)

Usage

npm i jelban.js
import { Jelban } from 'jelban.js';


// Instantiate the library
const jelban = new Jelban();

console.log(jelban.isValid('[email protected]')); // prints "true"

console.log(jelban.isValid('[email protected]')); // throws: "Invalid email address "[email protected]", rules: ["IsExcludedDomainValidator"]" because "@boxmail.live" is a temporary domain from mohamal.com service

// If you don't want to throw on failed validations and return "false" instead:
console.log(jelban.isValid('[email protected]', false)); // prints "false"

Parameters

Param Description Required Default
noGmailAliases When set to true, this will exclude Gmail aliases as described in providers/gmail false true
noOutlookAliases When set to true, this will exclude Outlook aliases as described in providers/Outlook false true
noDisposableEmailAddresses When set to true, this will exclude temporary email addresses from services like mohmal.com false true
excludeDomains A list of email address domains that you may want to exclude false []
allowDomains A list of restricted domains you want to include, default is [] which will skip this validation rule false []

Development

To run the project locally

# Use recommended Node version
nvm install
nvm use

# install dependencies
npm i

# run tests
npm test

# run mutation tests
npm run mutate

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

This project is licensed under the MIT License - see the LICENSE file for details

jelban-js's People

Contributors

dependabot[bot] avatar fcmam5 avatar prasad83 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

prasad83

jelban-js's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.