reserved-email-addresses-list
Advanced tools
Comparing version 0.0.6 to 0.0.7
{ | ||
"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); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22583
0
125
- Removedreserved-email-addresses-list@^0.0.3
- Removedreserved-email-addresses-list@0.0.3(transitive)