Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reserved-email-addresses-list

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reserved-email-addresses-list - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

6

package.json
{
"name": "reserved-email-addresses-list",
"description": "List of 1250+ email addresses reserved for security concerns",
"version": "0.0.6",
"version": "0.0.7",
"author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)",

@@ -18,5 +18,3 @@ "bugs": {

],
"dependencies": {
"reserved-email-addresses-list": "^0.0.3"
},
"dependencies": {},
"devDependencies": {

@@ -23,0 +21,0 @@ "@commitlint/cli": "latest",

@@ -29,3 +29,3 @@ # reserved-email-addresses-list

```sh
npm install reserved-email-addresses-list validator
npm install reserved-email-addresses-list validator nodemailer
```

@@ -36,3 +36,3 @@

```sh
yarn add reserved-email-addresses-list validator
yarn add reserved-email-addresses-list validator nodemailer
```

@@ -48,8 +48,32 @@

```js
const email = 'Admin***!!!@example.com';
const reservedEmailAddressesList = require('reserved-email-addresses-list');
const reservedAdminList = require('reserved-email-addresses-list/admin-list.json');
const validator = require('validator');
const email = '"Admin***!!!"@example.com';
//
// NOTE: No current npm package validates an address properly to RFC/IDN spec
// however according to research in the link below, the `validator` library
// has the highest percentage of passing tests across edge cases
//
// <https://webmasters.stackexchange.com/questions/104811/is-there-any-list-of-email-addresses-reserved-because-of-security-concerns-for-a/127447#comment173697_127447>
//
if (!validator.isEmail(email))
throw new Error('Email was not a valid address');
const str = email.split('@')[0].toLowerCase();
//
// NOTE: No current npm package properly parses the local part of an email
// address, therefore we write some custom logic here to get the last @ symbol
// and then slice the string from 0 (first character) to the @ symbol)
//
// The problem is that packages parse based off the first `indexOf`
// and not the `lastIndexOf`, so therefore errors like this would occur:
// e.g. this is a valid email address: `"test@test.test"@example.com`,
// but it is parsed incorrectly by all packages
//
// <https://github.com/nodemailer/nodemailer/issues/1102>
//
const lastIndexOfAtSymbol = email.lastIndexOf('@');
const str = email.slice(0, lastIndexOfAtSymbol).toLowerCase();

@@ -56,0 +80,0 @@ let reservedMatch = reservedEmailAddressesList.find(addr => addr === str);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc