Giter Club home page Giter Club logo

reserved-email-addresses-list's Introduction

reserved-email-addresses-list

build status code style styled with prettier made with lass license npm downloads

List of 1250+ generic, admin, mailer-daemon, and no-reply usernames reserved for security concerns. Made for Forward Email.

Table of Contents

Install

npm:

npm install reserved-email-addresses-list email-addresses

Usage

The string you are comparing with must be converted to lowercase and trimmed of whitespace. The reason we are converting to lowercase is because the dictionary of words we are comparing with are all lowercase, and in order to compare for strict equality, we must have matching case.

It is also highly recommended that you check for strict equality, and for a list of admin, mailer-daemon, and no-reply usernames, you should check for strict equality, starts with, or ends with comparisons as well.

const reservedEmailAddressesList = require('reserved-email-addresses-list');
const reservedAdminList = require('reserved-email-addresses-list/admin-list.json');
const emailAddresses = require('email-addresses');

const email = '"Admin***!!!"@example.com';
const parsed = emailAddresses.parseOneAddress(email);

if (parsed === null) throw new Error('Email was not a valid address');

const str = parsed.local.toLowerCase();

let reservedMatch = reservedEmailAddressesList.find(addr => addr === str);

if (!reservedMatch)
  reservedMatch = reservedAdminList.find(
    addr => addr === str || str.startsWith(addr) || str.endsWith(addr)
  );

if (reservedMatch)
  throw new Error(
    'User must be a domain admin to create an alias with a reserved word (see https://forwardemail.net/reserved-email-addresses).'
  );

Lists

Formats

The default list index.json itself comes in a few different formats. The default import is an Array, but also available are a Map and Set version of the list.

// Array version
const reservedEmailAddressesList = require('reserved-email-addresses-list');
// Also available with: require('reserved-email-addresses-list/array');

// Map version
const reservedEmailAddressesMap = require('reserved-email-addresses-list/map');

// Set version
const reservedEmailAddressesSet = require('reserved-email-addresses-list/set');

If you would like to create a Map or Set version of the other lists, simply require them first, and then convert to a Set or Map (see map.cjs, set.cjs, and other files in this repo for more insight how to do this).

References

Contributors

Name Website
Nick Baugh http://niftylettuce.com/

License

MIT © Nick Baugh

reserved-email-addresses-list's People

Contributors

loveandcoding avatar matbrgz avatar niftylettuce avatar sravan-s avatar titanism 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  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  avatar

reserved-email-addresses-list's Issues

Prefix and suffix checks seem too aggressive

Thanks for this list.

I see that you recommend this:

It is also highly recommended that you check for strict equality, and for a list of admin, mailer-daemon, and no-reply usernames, you should check for strict equality, starts with, or ends with comparisons as well.

However when I check this file:
https://github.com/forwardemail/reserved-email-addresses-list/blob/master/admin-list.json

I see words like "app", "dev", "hello", "dns"... etc.

What about "awesomeapp", "whatsapp", "devtutorials", "devto", "hellokitty", "dnsimple"... all those names are legit and probably used as handles on social media. Isn't too much to block all of them?

Use Map or Object as an alternative to Array

This is a request to ship a js Map or js Object along with/instead of the array version.

The lookup on the Map/Object is O(1) while array is O(n). When checking upon signups and signins, this makes a difference when there are many requests per second.

Thanks.

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.