push all website files

This commit is contained in:
Jacob Levine
2019-01-06 13:14:45 -06:00
parent d7301e26c3
commit d2d5d4c04e
15662 changed files with 2166516 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
# Change Log
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.3.1"></a>
## [1.3.1](https://github.com/npm/npm-audit-report/compare/v1.3.0...v1.3.1) (2018-07-10)
<a name="1.3.0"></a>
# [1.3.0](https://github.com/npm/npm-audit-report/compare/v1.2.1...v1.3.0) (2018-07-09)
### Bug Fixes
* **deps:** remove object.values dependency ([2c5374a](https://github.com/npm/npm-audit-report/commit/2c5374a))
* **detail:** Fix info-level severity ([#18](https://github.com/npm/npm-audit-report/issues/18)) ([807db5a](https://github.com/npm/npm-audit-report/commit/807db5a))
* **tests:** a test should not cause side-effects in other tests ([#23](https://github.com/npm/npm-audit-report/issues/23)) ([a94449f](https://github.com/npm/npm-audit-report/commit/a94449f))
### Features
* **output:** add `parseable` tabular output format support ([#21](https://github.com/npm/npm-audit-report/issues/21)) ([1c9aaf4](https://github.com/npm/npm-audit-report/commit/1c9aaf4))
<a name="1.2.1"></a>
## [1.2.1](https://github.com/npm/npm-audit-report/compare/v1.2.0...v1.2.1) (2018-05-17)
### Bug Fixes
* **detail:** count id+path instead of just id ([99880fd](https://github.com/npm/npm-audit-report/commit/99880fd))
<a name="1.2.0"></a>
# [1.2.0](https://github.com/npm/npm-audit-report/compare/v1.1.0...v1.2.0) (2018-05-16)
### Bug Fixes
* **full-report:** Fix install flag for devDependencies ([#14](https://github.com/npm/npm-audit-report/issues/14)) ([30e5f30](https://github.com/npm/npm-audit-report/commit/30e5f30))
### Features
* **detail:** consistified full report with install report ([#15](https://github.com/npm/npm-audit-report/issues/15)) ([6df6810](https://github.com/npm/npm-audit-report/commit/6df6810))
* **install:** include `npm audit` recommendation too ([32fb153](https://github.com/npm/npm-audit-report/commit/32fb153))
<a name="1.1.0"></a>
# [1.1.0](https://github.com/npm/npm-audit-report/compare/v1.0.9...v1.1.0) (2018-05-10)
### Bug Fixes
* **install:** not enough data for this conditional ([6ddc30c](https://github.com/npm/npm-audit-report/commit/6ddc30c))
### Features
* **report:** compress and reformat human-readable install report ([74d5203](https://github.com/npm/npm-audit-report/commit/74d5203))

View File

@@ -0,0 +1,16 @@
ISC License
Copyright (c) npm, Inc.
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE COPYRIGHT HOLDER DISCLAIMS
ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -0,0 +1,40 @@
# npm audit security report
Given a response from the npm security api, render it into a variety of security reports
[![Build Status](https://travis-ci.org/npm/npm-audit-report.svg?branch=master)](https://travis-ci.org/npm/npm-audit-report)
[![Build status](https://ci.appveyor.com/api/projects/status/qictiokvxmqkiuvi/branch/master?svg=true)](https://ci.appveyor.com/project/evilpacket/npm-audit-report/branch/master)
[![Coverage Status](https://coveralls.io/repos/github/npm/npm-audit-report/badge.svg?branch=master)](https://coveralls.io/github/npm/npm-audit-report?branch=master)
The response is an object that contains an output string (the report) and a suggested exitCode.
```
{
report: 'string that contains the security report',
exit: 1
}
```
## Basic usage example
```
'use strict'
const Report = require('npm-audit-report')
const options = {
reporter: 'json'
}
Report(response, options, (result) => {
console.log(result.report)
process.exitCode = result.exitCode
})
```
## options
| option | values | default | description |
| :--- | :--- | :--- |:--- |
| reporter     | `install`, `detail`, `json`, `quiet` | `install` | specify which output format you want to use |
| withColor     | `true`, `false`   | `true`   | indicates if some report elements should use colors |
| withUnicode   | `true`, `false`                  | `true` | indicates if unicode characters should be used|

View File

@@ -0,0 +1,25 @@
'use strict'
const reporters = {
install: require('./reporters/install'),
parseable: require('./reporters/parseable'),
detail: require('./reporters/detail'),
json: require('./reporters/json'),
quiet: require('./reporters/quiet')
}
const report = function (data, options) {
const defaults = {
reporter: 'install',
withColor: true,
withUnicode: true
}
const config = Object.assign({}, defaults, options)
return new Promise((resolve) => {
const result = reporters[config.reporter](data, config)
return resolve(result)
})
}
module.exports = report

View File

@@ -0,0 +1,60 @@
'use strict'
exports.severityLabel = severityLabel
exports.color = color
exports.totalVulnCount = totalVulnCount
exports.severities = severities
const ccs = require('console-control-strings')
const severityColors = {
critical: {
color: 'brightMagenta',
label: 'Critical'
},
high: {
color: 'brightRed',
label: 'High'
},
moderate: {
color: 'brightYellow',
label: 'Moderate'
},
low: {
color: 'bold',
label: 'Low'
},
info: {
color: '',
label: 'Info'
}
}
function color (value, colorName, withColor) {
return (colorName && withColor) ? ccs.color(colorName) + value + ccs.color('reset') : value
}
function severityLabel (sev, withColor, bold) {
if (!(sev in severityColors)) return sev.charAt(0).toUpperCase() + sev.substr(1).toLowerCase()
let colorName = severityColors[sev].color
if (bold) colorName = [colorName, 'bold']
return color(severityColors[sev].label, colorName, withColor)
}
function totalVulnCount (vulns) {
return Object.keys(vulns).reduce((accumulator, key) => {
const vulnCount = vulns[key]
accumulator += vulnCount
return accumulator
}, 0)
}
function severities (vulns) {
return Object.keys(vulns).reduce((accumulator, severity) => {
const vulnCount = vulns[severity]
if (vulnCount > 0) accumulator.push([severity, vulnCount])
return accumulator
}, [])
}

View File

@@ -0,0 +1,79 @@
{
"_from": "npm-audit-report@^1.2.1",
"_id": "npm-audit-report@1.3.1",
"_inBundle": true,
"_integrity": "sha512-SjTF8ZP4rOu3JiFrTMi4M1CmVo2tni2sP4TzhyCMHwnMGf6XkdGLZKt9cdZ12esKf0mbQqFyU9LtY0SoeahL7g==",
"_location": "/npm/npm-audit-report",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "npm-audit-report@^1.2.1",
"name": "npm-audit-report",
"escapedName": "npm-audit-report",
"rawSpec": "^1.2.1",
"saveSpec": null,
"fetchSpec": "^1.2.1"
},
"_requiredBy": [
"/npm"
],
"_resolved": "https://registry.npmjs.org/npm-audit-report/-/npm-audit-report-1.3.1.tgz",
"_shasum": "e79ea1fcb5ffaf3031102b389d5222c2b0459632",
"_spec": "npm-audit-report@^1.2.1",
"_where": "/Users/zkat/Documents/code/work/npm",
"author": {
"name": "Adam Baldwin"
},
"bugs": {
"url": "https://github.com/npm/npm-audit-report/issues"
},
"bundleDependencies": false,
"dependencies": {
"cli-table3": "^0.5.0",
"console-control-strings": "^1.1.0"
},
"deprecated": false,
"description": "Given a response from the npm security api, render it into a variety of security reports",
"devDependencies": {
"keyfob": "^1.0.0",
"standard": "^11.0.1",
"standard-version": "^4.3.0",
"tap": "^11.1.5",
"weallbehave": "^1.2.0",
"weallcontribute": "^1.0.8"
},
"directories": {
"lib": "lib",
"test": "test"
},
"files": [
"index.js",
"lib",
"reporters"
],
"homepage": "https://github.com/npm/npm-audit-report#readme",
"keywords": [
"npm",
"security",
"report",
"audit"
],
"license": "ISC",
"main": "index.js",
"name": "npm-audit-report",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/npm-audit-report.git"
},
"scripts": {
"postrelease": "npm publish && git push --follow-tags",
"prerelease": "npm t",
"pretest": "standard",
"release": "standard-version -s",
"test": "tap --100 -J --coverage test/*.js",
"update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'",
"update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'"
},
"version": "1.3.1"
}

View File

@@ -0,0 +1,197 @@
'use strict'
const summary = require('./install.js').summary
const Table = require('cli-table3')
const Utils = require('../lib/utils')
const report = function (data, options) {
const defaults = {
severityThreshold: 'info'
}
const blankChars = {
'top': ' ',
'top-mid': ' ',
'top-left': ' ',
'top-right': ' ',
'bottom': ' ',
'bottom-mid': ' ',
'bottom-left': ' ',
'bottom-right': ' ',
'left': ' ',
'left-mid': ' ',
'mid': ' ',
'mid-mid': ' ',
'right': ' ',
'right-mid': ' ',
'middle': ' '
}
const config = Object.assign({}, defaults, options)
let output = ''
let exit = 0
const log = function (value) {
output = output + value + '\n'
}
const footer = function (data) {
const total = Utils.totalVulnCount(data.metadata.vulnerabilities)
if (total > 0) {
exit = 1
}
log(`${summary(data, config)} in ${data.metadata.totalDependencies} scanned package${data.metadata.totalDependencies === 1 ? '' : 's'}`)
if (total) {
const counts = data.actions.reduce((acc, {action, isMajor, resolves}) => {
if (action === 'update' || (action === 'install' && !isMajor)) {
resolves.forEach(({id, path}) => acc.advisories.add(`${id}::${path}`))
}
if (isMajor) {
resolves.forEach(({id, path}) => acc.major.add(`${id}::${path}`))
}
if (action === 'review') {
resolves.forEach(({id, path}) => acc.review.add(`${id}::${path}`))
}
return acc
}, {advisories: new Set(), major: new Set(), review: new Set()})
if (counts.advisories.size) {
log(` run \`npm audit fix\` to fix ${counts.advisories.size} of them.`)
}
if (counts.major.size) {
const maj = counts.major.size
log(` ${maj} vulnerabilit${maj === 1 ? 'y' : 'ies'} require${maj === 1 ? 's' : ''} semver-major dependency updates.`)
}
if (counts.review.size) {
const rev = counts.review.size
log(` ${rev} vulnerabilit${rev === 1 ? 'y' : 'ies'} require${rev === 1 ? 's' : ''} manual review. See the full report for details.`)
}
}
}
const reportTitle = function () {
const tableOptions = {
colWidths: [78]
}
tableOptions.chars = blankChars
const table = new Table(tableOptions)
table.push([{
content: '=== npm audit security report ===',
vAlign: 'center',
hAlign: 'center'
}])
log(table.toString())
}
const actions = function (data, config) {
reportTitle()
if (Object.keys(data.advisories).length !== 0) {
// vulns found display a report.
let reviewFlag = false
data.actions.forEach((action) => {
if (action.action === 'update' || action.action === 'install') {
const recommendation = getRecommendation(action, config)
const label = action.resolves.length === 1 ? 'vulnerability' : 'vulnerabilities'
log(`# Run ${Utils.color(' ' + recommendation.cmd + ' ', 'inverse', config.withColor)} to resolve ${action.resolves.length} ${label}`)
if (recommendation.isBreaking) {
log(`SEMVER WARNING: Recommended action is a potentially breaking change`)
}
action.resolves.forEach((resolution) => {
const advisory = data.advisories[resolution.id]
const tableOptions = {
colWidths: [15, 62],
wordWrap: true
}
if (!config.withUnicode) {
tableOptions.chars = blankChars
}
const table = new Table(tableOptions)
table.push(
{[Utils.severityLabel(advisory.severity, config.withColor, true)]: Utils.color(advisory.title, 'bold', config.withColor)},
{'Package': advisory.module_name},
{'Dependency of': `${resolution.path.split('>')[0]} ${resolution.dev ? '[dev]' : ''}`},
{'Path': `${resolution.path.split('>').join(Utils.color(' > ', 'grey', config.withColor))}`},
{'More info': `https://nodesecurity.io/advisories/${advisory.id}`}
)
log(table.toString() + '\n\n')
})
}
if (action.action === 'review') {
if (!reviewFlag) {
const tableOptions = {
colWidths: [78]
}
if (!config.withUnicode) {
tableOptions.chars = blankChars
}
const table = new Table(tableOptions)
table.push([{
content: 'Manual Review\nSome vulnerabilities require your attention to resolve\n\nVisit https://go.npm.me/audit-guide for additional guidance',
vAlign: 'center',
hAlign: 'center'
}])
log(table.toString())
}
reviewFlag = true
action.resolves.forEach((resolution) => {
const advisory = data.advisories[resolution.id]
const tableOptions = {
colWidths: [15, 62],
wordWrap: true
}
if (!config.withUnicode) {
tableOptions.chars = blankChars
}
const table = new Table(tableOptions)
const patchedIn = advisory.patched_versions.replace(' ', '') === '<0.0.0' ? 'No patch available' : advisory.patched_versions
table.push(
{[Utils.severityLabel(advisory.severity, config.withColor, true)]: Utils.color(advisory.title, 'bold', config.withColor)},
{'Package': advisory.module_name},
{'Patched in': patchedIn},
{'Dependency of': `${resolution.path.split('>')[0]} ${resolution.dev ? '[dev]' : ''}`},
{'Path': `${resolution.path.split('>').join(Utils.color(' > ', 'grey', config.withColor))}`},
{'More info': `https://nodesecurity.io/advisories/${advisory.id}`}
)
log(table.toString())
})
}
})
}
}
actions(data, config)
footer(data)
return {
report: output.trim(),
exitCode: exit
}
}
const getRecommendation = function (action, config) {
if (action.action === 'install') {
const isDev = action.resolves[0].dev
return {
cmd: `npm install ${isDev ? '--save-dev ' : ''}${action.module}@${action.target}`,
isBreaking: action.isMajor
}
} else {
return {
cmd: `npm update ${action.module} --depth ${action.depth}`,
isBreaking: false
}
}
}
module.exports = report

View File

@@ -0,0 +1,61 @@
'use strict'
const Utils = require('../lib/utils')
module.exports = report
function report (data, options) {
let msg = summary(data, options)
if (!Object.keys(data.advisories).length) {
return {
report: msg,
exitCode: 0
}
} else {
msg += '\n run `npm audit fix` to fix them, or `npm audit` for details'
return {
report: msg,
exitCode: 1
}
}
}
module.exports.summary = summary
function summary (data, options) {
const defaults = {
severityThreshold: 'info'
}
const config = Object.assign({}, defaults, options)
function clr (str, clr) { return Utils.color(str, clr, config.withColor) }
function green (str) { return clr(str, 'brightGreen') }
function red (str) { return clr(str, 'brightRed') }
let output = ''
const log = function (value) {
output = output + value + '\n'
}
output += 'found '
if (Object.keys(data.advisories).length === 0) {
log(`${green('0')} vulnerabilities`)
return output
} else {
const total = Utils.totalVulnCount(data.metadata.vulnerabilities)
const sev = Utils.severities(data.metadata.vulnerabilities)
if (sev.length > 1) {
const severities = sev.map((value) => {
return `${value[1]} ${Utils.severityLabel(value[0], config.withColor).toLowerCase()}`
}).join(', ')
log(`${red(total)} vulnerabilities (${severities})`)
} else {
const vulnCount = sev[0][1]
const vulnLabel = Utils.severityLabel(sev[0][0], config.withColor).toLowerCase()
log(`${vulnCount} ${vulnLabel} severity vulnerabilit${vulnCount === 1 ? 'y' : 'ies'}`)
}
}
return output.trim()
}

View File

@@ -0,0 +1,17 @@
'use strict'
const report = function (data, options) {
const defaults = {
indent: 2
}
const config = Object.assign({}, defaults, options)
const json = JSON.stringify(data, null, config.indent)
return {
report: json,
exitCode: 0
}
}
module.exports = report

View File

@@ -0,0 +1,96 @@
'use strict'
const report = function (data, options) {
const defaults = {
severityThreshold: 'info'
}
const config = Object.assign({}, defaults, options)
let exit = 0
const actions = function (data, config) {
let accumulator = {
high: '',
moderate: '',
low: ''
}
if (Object.keys(data.advisories).length !== 0) {
data.actions.forEach((action) => {
let l = {}
// Start with install/update actions
if (action.action === 'update' || action.action === 'install') {
const recommendation = getRecommendation(action, config)
l.recommendation = recommendation.cmd
l.breaking = recommendation.isBreaking ? 'Y' : 'N'
// TODO: Verify: The advisory seems to repeat and be the same for all the 'resolves'. Is it true?
const advisory = data.advisories[action.resolves[0].id]
l.sevLevel = advisory.severity
l.severity = advisory.title
l.package = advisory.module_name
l.moreInfo = `https://nodesecurity.io/advisories/${advisory.id}`
l.path = action.resolves[0].path
accumulator[advisory.severity] += [action.action, l.package, l.sevLevel, l.recommendation, l.severity, l.moreInfo, l.path, l.breaking]
.join('\t') + '\n'
}
if (action.action === 'review') {
action.resolves.forEach((resolution) => {
const advisory = data.advisories[resolution.id]
l.sevLevel = advisory.severity
l.severity = advisory.title
l.package = advisory.module_name
l.moreInfo = `https://nodesecurity.io/advisories/${advisory.id}`
l.patchedIn = advisory.patched_versions.replace(' ', '') === '<0.0.0' ? 'No patch available' : advisory.patched_versions
l.path = resolution.path
accumulator[advisory.severity] += [action.action, l.package, l.sevLevel, l.patchedIn, l.severity, l.moreInfo, l.path].join('\t') + '\n'
}) // forEach resolves
} // is review
}) // forEach actions
}
return accumulator['high'] + accumulator['moderate'] + accumulator['low']
}
const exitCode = function (metadata) {
let total = 0
const keys = Object.keys(metadata.vulnerabilities)
for (let key of keys) {
const value = metadata.vulnerabilities[key]
total = total + value
}
if (total > 0) {
exit = 1
}
}
exitCode(data.metadata)
return {
report: actions(data, config),
exitCode: exit
}
}
const getRecommendation = function (action, config) {
if (action.action === 'install') {
const isDev = action.resolves[0].dev
return {
cmd: `npm install ${isDev ? '--save-dev ' : ''}${action.module}@${action.target}`,
isBreaking: action.isMajor
}
} else {
return {
cmd: `npm update ${action.module} --depth ${action.depth}`,
isBreaking: false
}
}
}
module.exports = report

View File

@@ -0,0 +1,14 @@
'use strict'
const Utils = require('../lib/utils')
const report = function (data) {
const totalVulnCount = Utils.totalVulnCount(data.metadata.vulnerabilities)
return {
report: '',
exitCode: totalVulnCount === 0 ? 0 : 1
}
}
module.exports = report