This commit is contained in:
groovecoder 2018-02-05 16:06:05 -06:00
Родитель 5950806402
Коммит fcf85adaaf
10 изменённых файлов: 478 добавлений и 116 удалений

Просмотреть файл

@ -14,3 +14,6 @@ OAUTH_CLIENT_SECRET=f5fb99de6e0af18ab17e013ac1d439903179a97a1c510fc10bc3bd50bbce
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"
HIBP_API_ROOT="https://stage.haveibeenpwned.com/api/v2/"
HIBP_API_TOKEN=""

2
.gitignore поставляемый
Просмотреть файл

@ -2,3 +2,5 @@ node_modules
.env
.nyc_output
.coveralls.yml
.DS_Store
breach_hashsets

Просмотреть файл

@ -51,14 +51,6 @@ for more background, objectives, key use cases.
2. Visit the `test.html` page at [localhost:6060/test.html](http://localhost:6060/test.html)
### Lint
After installing the dependencies, you can lint the code by calling:
```sh
npm run lint
```
#### Emails
The included `.env-dist` sets `DEBUG_DUMMY_SMTP=1` which disables emails.
@ -91,9 +83,34 @@ OAUTH_PROFILE_URI="https://stable.dev.lcip.org/profile/v1/profile"
OAUTH_TOKEN_URI="https://oauth-stable.dev.lcip.org/v1/token"
```
#### Breach Hashsets
This requires an enterprise subscriber API token from HIBP, which you will have
to get manually. Please ask a project admin if you need one. To download HIBP
breach hashsets, set a `HIBP_API_TOKEN` environment variable. You can set and
source it via the `.env` file, or set it directly:
```sh
export HIBP_API_TOKEN="<HIBP-API-TOKEN>"
```
With the `HIBP_API_TOKEN` set, run the `get_hashsets.js` script:
```sh
node get_hashsets.js
```
This will download the `.zip` files into `breach_hashsets/` directory.
## Testing
TBD
### Lint
After installing the dependencies, you can lint the code by calling:
```sh
npm run lint
```
## Deployment

Просмотреть файл

@ -17,6 +17,8 @@ const kEnvironmentVariables = [
"OAUTH_PROFILE_URI",
"OAUTH_CLIENT_ID",
"OAUTH_CLIENT_SECRET",
"HIBP_API_ROOT",
"HIBP_API_TOKEN"
];
const AppConstants = {

59
get_hashsets.js Normal file
Просмотреть файл

@ -0,0 +1,59 @@
"use strict";
const AppConstants = require("./app-constants").init();
const fs = require("fs");
const path = require("path");
const request = require("request");
const pkg = require("./package.json");
const HIBP_AUTH = `Bearer ${AppConstants.HIBP_API_TOKEN}`;
const USER_AGENT = `${pkg.name}@${pkg.version}`;
const BREACH_HASHSET_DIR = "breach_hashsets";
function getBreachHashset(breach) {
/*
* HIBP Breach, Object.keys(breach):
* [ 'Title', 'Name', 'Domain', 'BreachDate', 'AddedDate', 'ModifiedDate', 'PwnCount', 'Description',
'DataClasses', 'IsVerified', 'IsFabricated', 'IsSensitive', 'IsActive', 'IsRetired', 'IsSpamList',
'LogoType' ]
* See https://haveibeenpwned.com/API/v2#BreachModel for more
*/
if (breach.IsActive && breach.IsVerified && breach.DataClasses.includes("Email addresses")) {
console.log("Active, verified breach with email addresses: " + breach.Name);
const url = AppConstants.HIBP_API_ROOT + "/enterprisesubscriber/hashset/" + breach.Name;
console.log("url: " + url);
const headers = {
"User-Agent": USER_AGENT,
"Authorization": HIBP_AUTH,
};
const hashsetRequestObject = {
url: url,
headers: headers,
};
request(hashsetRequestObject).pipe(fs.createWriteStream(path.join(BREACH_HASHSET_DIR, `${breach.Name}.zip`)));
}
}
function handleBreachesResponse(error, response, body) {
let breachesJSON = JSON.parse(body);
for (let breach of breachesJSON) {
getBreachHashset(breach);
}
}
const breachesRequestObject = {
url: AppConstants.HIBP_API_ROOT + "/breaches",
headers: {
"User-Agent": USER_AGENT,
}
};
if (!fs.existsSync(BREACH_HASHSET_DIR)) {
fs.mkdirSync(BREACH_HASHSET_DIR);
}
request(breachesRequestObject, handleBreachesResponse);

470
package-lock.json сгенерированный
Просмотреть файл

@ -40,7 +40,6 @@
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
"dev": true,
"requires": {
"co": "4.6.0",
"fast-deep-equal": "1.0.0",
@ -110,14 +109,19 @@
"asn1": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz",
"integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=",
"dev": true
"integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y="
},
"assert-plus": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
"dev": true
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
},
"async": {
"version": "0.9.2",
"resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
"integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=",
"dev": true,
"optional": true
},
"asynckit": {
"version": "0.4.0",
@ -127,14 +131,12 @@
"aws-sign2": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=",
"dev": true
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg="
},
"aws4": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz",
"integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=",
"dev": true
"integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4="
},
"babel-code-frame": {
"version": "6.26.0",
@ -181,12 +183,46 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz",
"integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=",
"dev": true,
"optional": true,
"requires": {
"tweetnacl": "0.14.5"
}
},
"bl": {
"version": "0.9.5",
"resolved": "https://registry.npmjs.org/bl/-/bl-0.9.5.tgz",
"integrity": "sha1-wGt5evCF6gC8Unr8jvzxHeIjIFQ=",
"dev": true,
"requires": {
"readable-stream": "1.0.34"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
"dev": true
},
"readable-stream": {
"version": "1.0.34",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
"dev": true,
"requires": {
"core-util-is": "1.0.2",
"inherits": "2.0.3",
"isarray": "0.0.1",
"string_decoder": "0.10.31"
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
"dev": true
}
}
},
"body-parser": {
"version": "1.18.2",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz",
@ -208,15 +244,14 @@
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz",
"integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=",
"dev": true,
"requires": {
"hoek": "4.2.0"
}
},
"brace-expansion": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz",
"integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=",
"version": "1.1.9",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.9.tgz",
"integrity": "sha512-/+o3o6OV1cm3WKrO7U4wykU+ZICE6HiMEuravc2d03NIuM/VaRn5iMcoQ7NyxFXjvpmRICP2EER0YOnh4yIapA==",
"dev": true,
"requires": {
"balanced-match": "1.0.0",
@ -246,8 +281,7 @@
"caseless": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
"dev": true
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
},
"chalk": {
"version": "2.3.0",
@ -326,8 +360,202 @@
"co": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=",
"dev": true
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
},
"codecov.io": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/codecov.io/-/codecov.io-0.0.1.tgz",
"integrity": "sha1-JeorCV4enqEYcr36WEIRgTDfeLE=",
"dev": true,
"requires": {
"request": "2.42.0",
"urlgrey": "0.4.0"
},
"dependencies": {
"asn1": {
"version": "0.1.11",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz",
"integrity": "sha1-VZvhg3bQik7E2+gId9J4GGObLfc=",
"dev": true,
"optional": true
},
"assert-plus": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz",
"integrity": "sha1-7nQAlBMALYTOxyGcasgRgS5yMWA=",
"dev": true,
"optional": true
},
"aws-sign2": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz",
"integrity": "sha1-xXED96F/wDfwLXwuZLYC6iI/fWM=",
"dev": true,
"optional": true
},
"boom": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/boom/-/boom-0.4.2.tgz",
"integrity": "sha1-emNune1O/O+xnO9JR6PGffrukRs=",
"dev": true,
"requires": {
"hoek": "0.9.1"
}
},
"caseless": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.6.0.tgz",
"integrity": "sha1-gWfBq4OX+1u5X5bSjlqBxQ8kesQ=",
"dev": true
},
"combined-stream": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz",
"integrity": "sha1-ATfmV7qlp1QcV6w3rF/AfXO03B8=",
"dev": true,
"optional": true,
"requires": {
"delayed-stream": "0.0.5"
}
},
"cryptiles": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-0.2.2.tgz",
"integrity": "sha1-7ZH/HxetE9N0gohZT4pIoNJvMlw=",
"dev": true,
"optional": true,
"requires": {
"boom": "0.4.2"
}
},
"delayed-stream": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz",
"integrity": "sha1-1LH0OpPoKW3+AmlPRoC8N6MTxz8=",
"dev": true,
"optional": true
},
"forever-agent": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz",
"integrity": "sha1-bQ4JxJIflKJ/Y9O0nF/v8epMUTA=",
"dev": true
},
"form-data": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-0.1.4.tgz",
"integrity": "sha1-kavXiKupcCsaq/qLwBAxoqyeOxI=",
"dev": true,
"optional": true,
"requires": {
"async": "0.9.2",
"combined-stream": "0.0.7",
"mime": "1.2.11"
}
},
"hawk": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/hawk/-/hawk-1.1.1.tgz",
"integrity": "sha1-h81JH5tG5OKurKM1QWdmiF0tHtk=",
"dev": true,
"optional": true,
"requires": {
"boom": "0.4.2",
"cryptiles": "0.2.2",
"hoek": "0.9.1",
"sntp": "0.2.4"
}
},
"hoek": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz",
"integrity": "sha1-PTIkYrrfB3Fup+uFuviAec3c5QU=",
"dev": true
},
"http-signature": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.10.1.tgz",
"integrity": "sha1-T72sEyVZqoMjEh5UB3nAoBKyfmY=",
"dev": true,
"optional": true,
"requires": {
"asn1": "0.1.11",
"assert-plus": "0.1.5",
"ctype": "0.5.3"
}
},
"mime": {
"version": "1.2.11",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz",
"integrity": "sha1-WCA+7Ybjpe8XrtK32evUfwpg3RA=",
"dev": true,
"optional": true
},
"mime-types": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-1.0.2.tgz",
"integrity": "sha1-mVrhOSq4r/y/yyZB3QVOlDwNXc4=",
"dev": true
},
"node-uuid": {
"version": "1.4.8",
"resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz",
"integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=",
"dev": true
},
"oauth-sign": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.4.0.tgz",
"integrity": "sha1-8ilW8x6nFRqCHl8vsywRPK2Ln2k=",
"dev": true,
"optional": true
},
"qs": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-1.2.2.tgz",
"integrity": "sha1-GbV/8k3CqZzh+L32r82ln472H4g=",
"dev": true
},
"request": {
"version": "2.42.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.42.0.tgz",
"integrity": "sha1-VyvQFIk4VkBArHqxSLlkI6BjMEo=",
"dev": true,
"requires": {
"aws-sign2": "0.5.0",
"bl": "0.9.5",
"caseless": "0.6.0",
"forever-agent": "0.5.2",
"form-data": "0.1.4",
"hawk": "1.1.1",
"http-signature": "0.10.1",
"json-stringify-safe": "5.0.1",
"mime-types": "1.0.2",
"node-uuid": "1.4.8",
"oauth-sign": "0.4.0",
"qs": "1.2.2",
"stringstream": "0.0.5",
"tough-cookie": "2.3.3",
"tunnel-agent": "0.4.3"
}
},
"sntp": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/sntp/-/sntp-0.2.4.tgz",
"integrity": "sha1-+4hfGLDzqtGJ+CSGJTa87ux1CQA=",
"dev": true,
"optional": true,
"requires": {
"hoek": "0.9.1"
}
},
"tunnel-agent": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz",
"integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=",
"dev": true
}
}
},
"color-convert": {
"version": "1.9.1",
@ -410,7 +638,7 @@
"requires": {
"js-yaml": "3.10.0",
"lcov-parse": "0.0.10",
"log-driver": "1.2.5",
"log-driver": "1.2.6",
"minimist": "1.2.0",
"request": "2.83.0"
},
@ -438,7 +666,6 @@
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz",
"integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=",
"dev": true,
"requires": {
"boom": "5.2.0"
},
@ -447,18 +674,23 @@
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz",
"integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==",
"dev": true,
"requires": {
"hoek": "4.2.0"
}
}
}
},
"ctype": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.3.tgz",
"integrity": "sha1-gsGMJGH3QRTvFsE1IkrQuRRMoS8=",
"dev": true,
"optional": true
},
"dashdash": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
"integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
"dev": true,
"requires": {
"assert-plus": "1.0.0"
}
@ -472,9 +704,9 @@
}
},
"deep-equal": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz",
"integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=",
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-0.1.2.tgz",
"integrity": "sha1-skbCuApXCkfBG+HZvRBw7IeLh84=",
"dev": true
},
"deep-is": {
@ -491,12 +723,20 @@
"requires": {
"foreach": "2.0.5",
"object-keys": "1.0.11"
},
"dependencies": {
"object-keys": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz",
"integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=",
"dev": true
}
}
},
"defined": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz",
"integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=",
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/defined/-/defined-0.0.0.tgz",
"integrity": "sha1-817qfXBekzuvE7LwOz+D2SFAOz4=",
"dev": true
},
"del": {
@ -553,7 +793,6 @@
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",
"integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=",
"dev": true,
"optional": true,
"requires": {
"jsbn": "0.1.1"
@ -668,7 +907,7 @@
"requires": {
"ignore": "3.3.7",
"minimatch": "3.0.4",
"resolve": "1.4.0",
"resolve": "1.5.0",
"semver": "5.5.0"
}
},
@ -792,8 +1031,7 @@
"extend": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz",
"integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=",
"dev": true
"integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ="
},
"external-editor": {
"version": "2.1.0",
@ -809,20 +1047,17 @@
"extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
"dev": true
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
},
"fast-deep-equal": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz",
"integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=",
"dev": true
"integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8="
},
"fast-json-stable-stringify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
"dev": true
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
},
"fast-levenshtein": {
"version": "2.0.6",
@ -845,18 +1080,6 @@
"through2": "0.2.3"
},
"dependencies": {
"deep-equal": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-0.1.2.tgz",
"integrity": "sha1-skbCuApXCkfBG+HZvRBw7IeLh84=",
"dev": true
},
"defined": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/defined/-/defined-0.0.0.tgz",
"integrity": "sha1-817qfXBekzuvE7LwOz+D2SFAOz4=",
"dev": true
},
"minimist": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.5.tgz",
@ -949,8 +1172,7 @@
"forever-agent": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=",
"dev": true
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE="
},
"form-data": {
"version": "2.3.1",
@ -994,7 +1216,6 @@
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
"integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
"dev": true,
"requires": {
"assert-plus": "1.0.0"
}
@ -1042,14 +1263,12 @@
"har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=",
"dev": true
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI="
},
"har-validator": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
"integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=",
"dev": true,
"requires": {
"ajv": "5.5.2",
"har-schema": "2.0.0"
@ -1083,7 +1302,6 @@
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz",
"integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==",
"dev": true,
"requires": {
"boom": "4.3.1",
"cryptiles": "3.1.2",
@ -1094,8 +1312,7 @@
"hoek": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz",
"integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==",
"dev": true
"integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ=="
},
"http-errors": {
"version": "1.6.2",
@ -1112,7 +1329,6 @@
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
"dev": true,
"requires": {
"assert-plus": "1.0.0",
"jsprim": "1.4.1",
@ -1256,8 +1472,7 @@
"is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
"dev": true
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
},
"isarray": {
"version": "1.0.0",
@ -1273,8 +1488,7 @@
"isstream": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
"dev": true
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
},
"js-tokens": {
"version": "3.0.2",
@ -1296,20 +1510,17 @@
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
"dev": true,
"optional": true
},
"json-schema": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=",
"dev": true
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="
},
"json-schema-traverse": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=",
"dev": true
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A="
},
"json-stable-stringify-without-jsonify": {
"version": "1.0.1",
@ -1320,8 +1531,7 @@
"json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=",
"dev": true
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
},
"jsonify": {
"version": "0.0.0",
@ -1333,7 +1543,6 @@
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
"integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
"dev": true,
"requires": {
"assert-plus": "1.0.0",
"extsprintf": "1.3.0",
@ -1369,10 +1578,13 @@
"dev": true
},
"log-driver": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.5.tgz",
"integrity": "sha1-euTsJXMC/XkNVXyxDJcQDYV7AFY=",
"dev": true
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.6.tgz",
"integrity": "sha512-iUHz4WAGsXwUmL1UergWrkFD2iTUrGLMsQDRYUWtS9FI+wSyM76vIL+THQt7vrQq5fZDGdrPSCFUfIlqII28tg==",
"dev": true,
"requires": {
"codecov.io": "0.0.1"
}
},
"lru-cache": {
"version": "4.1.1",
@ -1442,7 +1654,7 @@
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "1.1.8"
"brace-expansion": "1.1.9"
}
},
"minimist": {
@ -3084,8 +3296,7 @@
"oauth-sign": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz",
"integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=",
"dev": true
"integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM="
},
"object-assign": {
"version": "4.1.1",
@ -3100,9 +3311,9 @@
"dev": true
},
"object-keys": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz",
"integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=",
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz",
"integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=",
"dev": true
},
"on-finished": {
@ -3182,8 +3393,7 @@
"performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
"dev": true
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
},
"pify": {
"version": "2.3.0",
@ -3299,7 +3509,6 @@
"version": "2.83.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz",
"integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==",
"dev": true,
"requires": {
"aws-sign2": "0.7.0",
"aws4": "1.6.0",
@ -3336,9 +3545,9 @@
}
},
"resolve": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz",
"integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==",
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz",
"integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==",
"dev": true,
"requires": {
"path-parse": "1.0.5"
@ -3490,11 +3699,19 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz",
"integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==",
"dev": true,
"requires": {
"hoek": "4.2.0"
}
},
"split": {
"version": "0.2.10",
"resolved": "https://registry.npmjs.org/split/-/split-0.2.10.tgz",
"integrity": "sha1-Zwl8YB1pfOE2j0GPBs0gHPBSGlc=",
"dev": true,
"requires": {
"through": "2.3.8"
}
},
"sprintf": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/sprintf/-/sprintf-0.1.5.tgz",
@ -3511,7 +3728,6 @@
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz",
"integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=",
"dev": true,
"requires": {
"asn1": "0.2.3",
"assert-plus": "1.0.0",
@ -3528,6 +3744,15 @@
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz",
"integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew=="
},
"stream-combiner": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz",
"integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=",
"dev": true,
"requires": {
"duplexer": "0.1.1"
}
},
"string-width": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
@ -3560,8 +3785,7 @@
"stringstream": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
"integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=",
"dev": true
"integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg="
},
"strip-ansi": {
"version": "4.0.0",
@ -3663,11 +3887,32 @@
"through": "2.3.8"
},
"dependencies": {
"deep-equal": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz",
"integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=",
"dev": true
},
"defined": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz",
"integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=",
"dev": true
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true
},
"resolve": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz",
"integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==",
"dev": true,
"requires": {
"path-parse": "1.0.5"
}
}
}
},
@ -3740,7 +3985,6 @@
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
"dev": true,
"requires": {
"safe-buffer": "5.1.1"
}
@ -3749,7 +3993,6 @@
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
"dev": true,
"optional": true
},
"type-check": {
@ -3780,6 +4023,33 @@
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
},
"urlgrey": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/urlgrey/-/urlgrey-0.4.0.tgz",
"integrity": "sha1-8GU1cED7NcOzEdTl3DZITZbb6gY=",
"dev": true,
"requires": {
"tape": "2.3.0"
},
"dependencies": {
"tape": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tape/-/tape-2.3.0.tgz",
"integrity": "sha1-Df7scJIn+8yRcKvn8EaWKycUMds=",
"dev": true,
"requires": {
"deep-equal": "0.1.2",
"defined": "0.0.0",
"inherits": "2.0.3",
"jsonify": "0.0.0",
"resumer": "0.0.0",
"split": "0.2.10",
"stream-combiner": "0.0.4",
"through": "2.3.8"
}
}
}
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
@ -3793,8 +4063,7 @@
"uuid": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz",
"integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==",
"dev": true
"integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA=="
},
"vary": {
"version": "1.1.2",
@ -3805,7 +4074,6 @@
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
"integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
"dev": true,
"requires": {
"assert-plus": "1.0.0",
"core-util-is": "1.0.2",
@ -3849,14 +4117,6 @@
"dev": true,
"requires": {
"object-keys": "0.4.0"
},
"dependencies": {
"object-keys": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz",
"integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=",
"dev": true
}
}
},
"yallist": {

Просмотреть файл

@ -13,7 +13,8 @@
"dotenv": "^5.0.0",
"express": "^4.16.2",
"nodemailer": "^4.4.0",
"popsicle": "^9.2.0"
"popsicle": "^9.2.0",
"request": "^2.83.0"
},
"devDependencies": {
"coveralls": "^3.0.0",
@ -41,6 +42,6 @@
"lint": "eslint .",
"pretest": "eslint .",
"start": "node server.js",
"test": "nyc tape tests/**/*.js | faucet && nyc report --reporter=text-lcov | coveralls"
"test": "nyc tape tests/**/test*.js | faucet && nyc report --reporter=text-lcov | coveralls"
}
}

2
tests/fixtures/TestBreach.txt поставляемый Normal file
Просмотреть файл

@ -0,0 +1,2 @@
69020cadd01494505872663c38151bd6ffb8bbb6
12eeb998fe0c7600b3a3aacf518aa760b1dbd775

Двоичные данные
tests/fixtures/TestBreach.zip поставляемый Normal file

Двоичный файл не отображается.

16
tests/fixtures/make_sha1_hashes.js поставляемый Normal file
Просмотреть файл

@ -0,0 +1,16 @@
"use strict";
const crypto = require("crypto");
const stdin = process.openStdin();
console.log("Enter an email address to get the SHA1 hash as it would appear in a HIBP hashset file.");
stdin.addListener("data", data => {
const shasum = crypto.createHash("sha1");
const trimmedString = data.toString().trim();
console.log("You entered: [" + trimmedString + "], sha1 hash of lowercase: ");
shasum.update(trimmedString.toLowerCase());
console.log(shasum.digest("hex"));
console.log("Enter an email address to get the SHA1 hash as it would appear in a HIBP hashset file.");
});