@socketsecurity/cli 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/shadow/bin/npm +2 -0
- package/lib/shadow/bin/npx +2 -0
- package/lib/shadow/global.d.ts +3 -0
- package/lib/shadow/link.cjs +43 -0
- package/lib/shadow/npm-injection.cjs +369 -0
- package/lib/shadow/package.json +3 -0
- package/lib/shadow/translations.json +689 -0
- package/package.json +5 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
const { chmodSync, realpathSync } = require('fs')
|
|
3
|
+
const path = require('path')
|
|
4
|
+
|
|
5
|
+
const which = require('which')
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {string} realDirname path to shadow/bin
|
|
9
|
+
* @param {'npm' | 'npx'} binname
|
|
10
|
+
* @returns {string} path to npm provided cli / npx bin
|
|
11
|
+
*/
|
|
12
|
+
function installLinks (realDirname, binname) {
|
|
13
|
+
const realNpmShadowBinDir = realDirname
|
|
14
|
+
// find npm being shadowed by this process
|
|
15
|
+
const npms = which.sync(binname, {
|
|
16
|
+
all: true
|
|
17
|
+
})
|
|
18
|
+
let shadowIndex = -1
|
|
19
|
+
const npmpath = npms.find((npmPath, i) => {
|
|
20
|
+
const isShadow = realpathSync(path.dirname(npmPath)) === realNpmShadowBinDir
|
|
21
|
+
if (isShadow) {
|
|
22
|
+
shadowIndex = i
|
|
23
|
+
}
|
|
24
|
+
return !isShadow
|
|
25
|
+
})
|
|
26
|
+
if (!npmpath) {
|
|
27
|
+
console.error('Socket unable to locate npm ensure it is available in the PATH environment variable')
|
|
28
|
+
process.exit(127)
|
|
29
|
+
}
|
|
30
|
+
if (shadowIndex === -1) {
|
|
31
|
+
chmodSync(realNpmShadowBinDir, parseInt('755', 8))
|
|
32
|
+
const bindir = path.join(realDirname)
|
|
33
|
+
process.env['PATH'] = `${
|
|
34
|
+
bindir
|
|
35
|
+
}${
|
|
36
|
+
process.platform === 'win32' ? ';' : ':'
|
|
37
|
+
}${
|
|
38
|
+
process.env['PATH']
|
|
39
|
+
}`
|
|
40
|
+
}
|
|
41
|
+
return npmpath
|
|
42
|
+
}
|
|
43
|
+
module.exports = installLinks
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
// THIS MUST BE CJS TO WORK WITH --require
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
'use strict'
|
|
4
|
+
|
|
5
|
+
const fs = require('fs')
|
|
6
|
+
const path = require('path')
|
|
7
|
+
const https = require('https')
|
|
8
|
+
const events = require('events')
|
|
9
|
+
const rl = require('readline')
|
|
10
|
+
const oraPromise = import('ora')
|
|
11
|
+
const isInteractivePromise = import('is-interactive')
|
|
12
|
+
const chalkMarkdownPromise = import('../utils/chalk-markdown.js')
|
|
13
|
+
|
|
14
|
+
const pubToken = 'sktsec_t_--RAN5U4ivauy4w37-6aoKyYPDt5ZbaT5JBVMqiwKo_api'
|
|
15
|
+
|
|
16
|
+
// shadow `npm` and `npx` to mitigate subshells
|
|
17
|
+
require('./link.cjs')(fs.realpathSync(path.join(__dirname, 'bin')), 'npm')
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {string[]} pkgids
|
|
21
|
+
* @returns {AsyncGenerator<{eco: string, pkg: string, ver: string } & ({type: 'missing'} | {type: 'success', value: { issues: any[] }})>}
|
|
22
|
+
*/
|
|
23
|
+
async function * batchScan (
|
|
24
|
+
pkgids
|
|
25
|
+
) {
|
|
26
|
+
const query = {
|
|
27
|
+
packages: pkgids.map(pkgid => {
|
|
28
|
+
const delimiter = pkgid.lastIndexOf('@')
|
|
29
|
+
const name = pkgid.slice(0, delimiter)
|
|
30
|
+
const version = pkgid.slice(delimiter + 1)
|
|
31
|
+
return {
|
|
32
|
+
eco: 'npm', pkg: name, ver: version, top: true
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
const pkgDataReq = https.request(
|
|
37
|
+
'https://api.socket.dev/v0/scan/batch',
|
|
38
|
+
{
|
|
39
|
+
method: 'POST',
|
|
40
|
+
headers: {
|
|
41
|
+
Authorization: `Basic ${Buffer.from(`${pubToken}:`).toString('base64url')}`
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
).end(
|
|
45
|
+
JSON.stringify(query)
|
|
46
|
+
)
|
|
47
|
+
const [res] = await events.once(pkgDataReq, 'response')
|
|
48
|
+
const isSuccess = res.statusCode === 200
|
|
49
|
+
if (!isSuccess) {
|
|
50
|
+
throw new Error('Socket API Error: ' + res.statusCode)
|
|
51
|
+
}
|
|
52
|
+
const rli = rl.createInterface(res)
|
|
53
|
+
for await (const line of rli) {
|
|
54
|
+
const result = JSON.parse(line)
|
|
55
|
+
yield result
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @type {import('./translations.json') | null}
|
|
61
|
+
*/
|
|
62
|
+
let translations = null
|
|
63
|
+
/**
|
|
64
|
+
* @type {import('../utils/chalk-markdown.js').ChalkOrMarkdown | null}
|
|
65
|
+
*/
|
|
66
|
+
let formatter = null
|
|
67
|
+
|
|
68
|
+
const npmEntrypoint = fs.realpathSync(`${process.argv[1]}`)
|
|
69
|
+
/**
|
|
70
|
+
* @param {string} filepath
|
|
71
|
+
* @returns {string}
|
|
72
|
+
*/
|
|
73
|
+
function findRoot (filepath) {
|
|
74
|
+
if (path.basename(filepath) === 'npm') {
|
|
75
|
+
return filepath
|
|
76
|
+
}
|
|
77
|
+
const parent = path.dirname(filepath)
|
|
78
|
+
if (parent === filepath) {
|
|
79
|
+
process.exit(127)
|
|
80
|
+
}
|
|
81
|
+
return findRoot(parent)
|
|
82
|
+
}
|
|
83
|
+
const npmDir = findRoot(path.dirname(npmEntrypoint))
|
|
84
|
+
const arboristLibClassPath = path.join(npmDir, 'node_modules', '@npmcli', 'arborist', 'lib', 'arborist', 'index.js')
|
|
85
|
+
/**
|
|
86
|
+
* @type {typeof import('@npmcli/arborist')}
|
|
87
|
+
*/
|
|
88
|
+
const Arborist = require(arboristLibClassPath)
|
|
89
|
+
|
|
90
|
+
const kCtorArgs = Symbol('ctorArgs')
|
|
91
|
+
const kRiskyReify = Symbol('riskyReify')
|
|
92
|
+
class SafeArborist extends Arborist {
|
|
93
|
+
/**
|
|
94
|
+
* @param {ConstructorParameters<typeof Arborist>} ctorArgs
|
|
95
|
+
*/
|
|
96
|
+
constructor (...ctorArgs) {
|
|
97
|
+
const mutedArguments = [{
|
|
98
|
+
...(ctorArgs[0] ?? {}),
|
|
99
|
+
dryRun: true,
|
|
100
|
+
ignoreScripts: true,
|
|
101
|
+
save: false,
|
|
102
|
+
saveBundle: false,
|
|
103
|
+
audit: false,
|
|
104
|
+
// progress: false,
|
|
105
|
+
fund: false
|
|
106
|
+
}, ctorArgs.slice(1)]
|
|
107
|
+
super(...mutedArguments)
|
|
108
|
+
this[kCtorArgs] = ctorArgs
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @param {Parameters<InstanceType<typeof Arborist>['reify']>} args
|
|
113
|
+
*/
|
|
114
|
+
async [kRiskyReify] (...args) {
|
|
115
|
+
// safe arborist has suffered side effects and must be rebuilt from scratch
|
|
116
|
+
const arb = new Arborist(...this[kCtorArgs])
|
|
117
|
+
const ret = await arb.reify(...args)
|
|
118
|
+
Object.assign(this, arb)
|
|
119
|
+
return ret
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @param {Parameters<InstanceType<typeof Arborist>['reify']>} args
|
|
124
|
+
* @override
|
|
125
|
+
*/
|
|
126
|
+
async reify (...args) {
|
|
127
|
+
// @ts-expect-error types are wrong
|
|
128
|
+
if (args[0]?.dryRun) {
|
|
129
|
+
return this[kRiskyReify](...args)
|
|
130
|
+
}
|
|
131
|
+
args[0] ??= {}
|
|
132
|
+
const old = { ...args[0] }
|
|
133
|
+
// @ts-expect-error types are wrong
|
|
134
|
+
args[0].dryRun = true
|
|
135
|
+
args[0].save = false
|
|
136
|
+
args[0].saveBundle = false
|
|
137
|
+
// const originalDescriptors = Object.getOwnPropertyDescriptors(this)
|
|
138
|
+
// TODO: make this deal w/ any refactor to private fields by punching the class itself
|
|
139
|
+
await super.reify(...args)
|
|
140
|
+
const diff = gatherDiff(this)
|
|
141
|
+
// @ts-expect-error types are wrong
|
|
142
|
+
args[0].dryRun = old.dryRun
|
|
143
|
+
// @ts-expect-error types are wrong
|
|
144
|
+
args[0].save = old.save
|
|
145
|
+
// @ts-expect-error types are wrong
|
|
146
|
+
args[0].saveBundle = old.saveBundle
|
|
147
|
+
// nothing to check, mmm already installed?
|
|
148
|
+
if (diff.check.length === 0 && diff.unknowns.length === 0) {
|
|
149
|
+
return this[kRiskyReify](...args)
|
|
150
|
+
}
|
|
151
|
+
const isInteractive = (await isInteractivePromise).default()
|
|
152
|
+
if (isInteractive) {
|
|
153
|
+
const ora = (await oraPromise).default
|
|
154
|
+
const risky = await packagesHaveRiskyIssues(diff.check, ora)
|
|
155
|
+
if (risky) {
|
|
156
|
+
const rl = require('readline')
|
|
157
|
+
const rli = rl.createInterface(process.stdin, process.stderr)
|
|
158
|
+
while (true) {
|
|
159
|
+
/**
|
|
160
|
+
* @type {string}
|
|
161
|
+
*/
|
|
162
|
+
const answer = await new Promise((resolve) => {
|
|
163
|
+
rli.question('Accept risks of installing these packages (y/N)? ', (str) => resolve(str))
|
|
164
|
+
})
|
|
165
|
+
if (/^\s*y(es)?\s*$/i.test(answer)) {
|
|
166
|
+
break
|
|
167
|
+
} else if (/^(\s*no?\s*|)$/i.test(answer)) {
|
|
168
|
+
throw new Error('Socket npm exiting due to risks')
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return this[kRiskyReify](...args)
|
|
173
|
+
} else {
|
|
174
|
+
await packagesHaveRiskyIssues(diff.check)
|
|
175
|
+
throw new Error('Socket npm Unable to prompt to accept risk, need TTY to do so')
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
// @ts-ignore
|
|
180
|
+
require.cache[arboristLibClassPath].exports = SafeArborist
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @param {InstanceType<typeof Arborist>} arb
|
|
184
|
+
* @returns {{
|
|
185
|
+
* check: InstallEffect[],
|
|
186
|
+
* unknowns: InstallEffect[]
|
|
187
|
+
* }}
|
|
188
|
+
*/
|
|
189
|
+
function gatherDiff (arb) {
|
|
190
|
+
// TODO: make this support private registry complexities
|
|
191
|
+
const registry = arb.registry
|
|
192
|
+
/**
|
|
193
|
+
* @type {InstallEffect[]}
|
|
194
|
+
*/
|
|
195
|
+
const unknowns = []
|
|
196
|
+
/**
|
|
197
|
+
* @type {InstallEffect[]}
|
|
198
|
+
*/
|
|
199
|
+
const check = []
|
|
200
|
+
for (const node of walk(arb.diff)) {
|
|
201
|
+
if (node.resolved?.startsWith(registry)) {
|
|
202
|
+
check.push(node)
|
|
203
|
+
} else {
|
|
204
|
+
unknowns.push(node)
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
check,
|
|
209
|
+
unknowns
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* @typedef InstallEffect
|
|
214
|
+
* @property {import('@npmcli/arborist').Diff['action']} action
|
|
215
|
+
* @property {import('@npmcli/arborist').Node['pkgid'] | null} existing
|
|
216
|
+
* @property {import('@npmcli/arborist').Node['pkgid']} pkgid
|
|
217
|
+
* @property {import('@npmcli/arborist').Node['resolved']} resolved
|
|
218
|
+
* @property {import('@npmcli/arborist').Node['location']} location
|
|
219
|
+
*/
|
|
220
|
+
/**
|
|
221
|
+
* @param {import('@npmcli/arborist').Diff | null} diff
|
|
222
|
+
* @param {InstallEffect[]} needInfoOn
|
|
223
|
+
* @returns {InstallEffect[]}
|
|
224
|
+
*/
|
|
225
|
+
function walk (diff, needInfoOn = []) {
|
|
226
|
+
if (!diff) {
|
|
227
|
+
return needInfoOn
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (diff.action) {
|
|
231
|
+
const sameVersion = diff.actual?.package.version === diff.ideal?.package.version
|
|
232
|
+
let keep = false
|
|
233
|
+
let existing = null
|
|
234
|
+
if (diff.action === 'CHANGE') {
|
|
235
|
+
if (!sameVersion) {
|
|
236
|
+
existing = diff.actual.pkgid
|
|
237
|
+
keep = true
|
|
238
|
+
} else {
|
|
239
|
+
// console.log('SKIPPING META CHANGE ON', diff)
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
keep = diff.action !== 'REMOVE'
|
|
243
|
+
}
|
|
244
|
+
if (keep) {
|
|
245
|
+
if (diff.ideal?.pkgid) {
|
|
246
|
+
needInfoOn.push({
|
|
247
|
+
existing,
|
|
248
|
+
action: diff.action,
|
|
249
|
+
location: diff.ideal.location,
|
|
250
|
+
pkgid: diff.ideal.pkgid,
|
|
251
|
+
resolved: diff.ideal.resolved
|
|
252
|
+
})
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (diff.children) {
|
|
257
|
+
for (const child of diff.children) {
|
|
258
|
+
walk(child, needInfoOn)
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return needInfoOn
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* @param {InstallEffect[]} pkgs
|
|
266
|
+
* @param {import('ora')['default'] | null} ora
|
|
267
|
+
* @returns {Promise<boolean>}
|
|
268
|
+
*/
|
|
269
|
+
async function packagesHaveRiskyIssues (pkgs, ora = null) {
|
|
270
|
+
let failed = false
|
|
271
|
+
if (pkgs.length) {
|
|
272
|
+
let remaining = pkgs.length
|
|
273
|
+
/**
|
|
274
|
+
*
|
|
275
|
+
* @returns {string}
|
|
276
|
+
*/
|
|
277
|
+
function getText () {
|
|
278
|
+
return `Looking up data for ${remaining} packages`
|
|
279
|
+
}
|
|
280
|
+
const spinner = ora ? ora(getText()).start() : null
|
|
281
|
+
const pkgDatas = []
|
|
282
|
+
try {
|
|
283
|
+
for await (const pkgData of batchScan(pkgs.map(pkg => pkg.pkgid))) {
|
|
284
|
+
let failures = []
|
|
285
|
+
if (pkgData.type === 'missing') {
|
|
286
|
+
failures.push({
|
|
287
|
+
type: 'missingDependency'
|
|
288
|
+
})
|
|
289
|
+
continue
|
|
290
|
+
}
|
|
291
|
+
for (const issue of (pkgData.value?.issues ?? [])) {
|
|
292
|
+
if ([
|
|
293
|
+
'shellScriptOverride',
|
|
294
|
+
'gitDependency',
|
|
295
|
+
'httpDependency',
|
|
296
|
+
'installScripts',
|
|
297
|
+
'malware',
|
|
298
|
+
'didYouMean',
|
|
299
|
+
'hasNativeCode',
|
|
300
|
+
'troll',
|
|
301
|
+
'telemetry',
|
|
302
|
+
'invalidPackageJSON',
|
|
303
|
+
'unresolvedRequire',
|
|
304
|
+
].includes(issue.type)) {
|
|
305
|
+
failures.push(issue)
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
// before we ask about problematic issues, check to see if they already existed in the old version
|
|
309
|
+
// if they did, be quiet
|
|
310
|
+
if (failures.length) {
|
|
311
|
+
const pkg = pkgs.find(pkg => pkg.pkgid === `${pkgData.pkg}@${pkgData.ver}` && pkg.existing?.startsWith(pkgData.pkg))
|
|
312
|
+
if (pkg?.existing) {
|
|
313
|
+
for await (const oldPkgData of batchScan([pkg.existing])) {
|
|
314
|
+
if (oldPkgData.type === 'success') {
|
|
315
|
+
failures = failures.filter(
|
|
316
|
+
issue => oldPkgData.value.issues.find(oldIssue => oldIssue.type === issue.type) == null
|
|
317
|
+
)
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
if (failures.length) {
|
|
323
|
+
failed = true
|
|
324
|
+
spinner?.stop()
|
|
325
|
+
translations ??= JSON.parse(fs.readFileSync(path.join(__dirname, '/translations.json'), 'utf-8'))
|
|
326
|
+
formatter ??= new ((await chalkMarkdownPromise).ChalkOrMarkdown)(false)
|
|
327
|
+
const name = pkgData.pkg
|
|
328
|
+
const version = pkgData.ver
|
|
329
|
+
console.error(`${formatter.hyperlink(`${name}@${version}`, `https://socket.dev/npm/package/${name}/overview/${version}`)} contains risks:`)
|
|
330
|
+
if (translations) {
|
|
331
|
+
for (const failure of failures) {
|
|
332
|
+
const type = failure.type
|
|
333
|
+
if (type) {
|
|
334
|
+
// @ts-ignore
|
|
335
|
+
const issueTypeTranslation = translations.issues[type]
|
|
336
|
+
// TODO: emoji seems to misalign terminals sometimes
|
|
337
|
+
// @ts-ignore
|
|
338
|
+
const msg = ` ${issueTypeTranslation.title} - ${issueTypeTranslation.description}`
|
|
339
|
+
console.error(msg)
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
spinner?.start()
|
|
344
|
+
} else {
|
|
345
|
+
// TODO: have pacote/cacache download non-problematic files while waiting
|
|
346
|
+
}
|
|
347
|
+
remaining--
|
|
348
|
+
if (remaining !== 0) {
|
|
349
|
+
if (spinner) {
|
|
350
|
+
spinner.text = getText()
|
|
351
|
+
}
|
|
352
|
+
} else {
|
|
353
|
+
spinner?.stop()
|
|
354
|
+
}
|
|
355
|
+
pkgDatas.push(pkgData)
|
|
356
|
+
}
|
|
357
|
+
return failed
|
|
358
|
+
} finally {
|
|
359
|
+
if (spinner?.isSpinning) {
|
|
360
|
+
spinner?.stop()
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
} else {
|
|
364
|
+
if (ora) {
|
|
365
|
+
ora('').succeed('No changes detected')
|
|
366
|
+
}
|
|
367
|
+
return false
|
|
368
|
+
}
|
|
369
|
+
}
|
|
@@ -0,0 +1,689 @@
|
|
|
1
|
+
{
|
|
2
|
+
"issueCategories": {
|
|
3
|
+
"license": {
|
|
4
|
+
"title": "License"
|
|
5
|
+
},
|
|
6
|
+
"maintenance": {
|
|
7
|
+
"title": "Maintenance"
|
|
8
|
+
},
|
|
9
|
+
"miscellaneous": {
|
|
10
|
+
"title": "Miscellaneous"
|
|
11
|
+
},
|
|
12
|
+
"quality": {
|
|
13
|
+
"title": "Quality"
|
|
14
|
+
},
|
|
15
|
+
"supplyChainRisk": {
|
|
16
|
+
"title": "Supply chain risk"
|
|
17
|
+
},
|
|
18
|
+
"vulnerability": {
|
|
19
|
+
"title": "Vulnerability"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"issueSeverity": {
|
|
23
|
+
"0": "Low",
|
|
24
|
+
"1": "Medium",
|
|
25
|
+
"2": "High",
|
|
26
|
+
"3": "Critical"
|
|
27
|
+
},
|
|
28
|
+
"issues": {
|
|
29
|
+
"badEncoding": {
|
|
30
|
+
"description": "Source files are encoded using a non-standard text encoding.",
|
|
31
|
+
"props": {
|
|
32
|
+
"encoding": "Encoding"
|
|
33
|
+
},
|
|
34
|
+
"suggestion": "Ensure all published files are encoded using a standard encoding such as UTF8, UTF16, UTF32, SHIFT-JIS, etc.",
|
|
35
|
+
"title": "Bad text encoding",
|
|
36
|
+
"emoji": "⚠️"
|
|
37
|
+
},
|
|
38
|
+
"badSemver": {
|
|
39
|
+
"description": "Package version is not a valid semantic version (semver).",
|
|
40
|
+
"suggestion": "All versions of all packages on npm should use use a valid semantic version. Publish a new version of the package with a valid semantic version. Semantic version ranges do not work with invalid semantic versions.",
|
|
41
|
+
"title": "Bad semver",
|
|
42
|
+
"emoji": "⚠️"
|
|
43
|
+
},
|
|
44
|
+
"badSemverDependency": {
|
|
45
|
+
"description": "Package has dependencies with an invalid semantic version. This could be a sign of beta, low quality, or unmaintained dependencies.",
|
|
46
|
+
"props": {
|
|
47
|
+
"packageName": "Package name",
|
|
48
|
+
"packageVersion": "Package version"
|
|
49
|
+
},
|
|
50
|
+
"suggestion": "Switch to a version of the dependency with valid semver or override the dependency version if it is determined to be problematic.",
|
|
51
|
+
"title": "Bad dependency semver",
|
|
52
|
+
"emoji": "⚠️"
|
|
53
|
+
},
|
|
54
|
+
"bidi": {
|
|
55
|
+
"description": "Source files contain bidirectional unicode control characters. This could indicate a Trojan source supply chain attack. See: trojansource.code for more information.",
|
|
56
|
+
"suggestion": "Remove bidirectional unicode control characters, or clearly document what they are used for.",
|
|
57
|
+
"title": "Bidirectional unicode control characters",
|
|
58
|
+
"emoji": "⚠️"
|
|
59
|
+
},
|
|
60
|
+
"binScriptConfusion": {
|
|
61
|
+
"description": "This package has multiple bin scripts with the same name. This can cause non-deterministic behavior when installing or could be a sign of a supply chain attack",
|
|
62
|
+
"props": {
|
|
63
|
+
"binScript": "Bin script"
|
|
64
|
+
},
|
|
65
|
+
"suggestion": "Consider removing one of the conflicting packages. Packages should only export bin scripts with their name",
|
|
66
|
+
"title": "Bin script confusion",
|
|
67
|
+
"emoji": "😵💫"
|
|
68
|
+
},
|
|
69
|
+
"chronoAnomaly": {
|
|
70
|
+
"description": "Semantic versions published out of chronological order.",
|
|
71
|
+
"props": {
|
|
72
|
+
"prevChronoDate": "Previous chronological date",
|
|
73
|
+
"prevChronoVersion": "Previous chronological version",
|
|
74
|
+
"prevSemverDate": "Previous semver date",
|
|
75
|
+
"prevSemverVersion": "Previous semver version"
|
|
76
|
+
},
|
|
77
|
+
"suggestion": "This could either indicate dependency confusion or a patched vulnerability.",
|
|
78
|
+
"title": "Chronological version anomaly",
|
|
79
|
+
"emoji": "⚠️"
|
|
80
|
+
},
|
|
81
|
+
"criticalCVE": {
|
|
82
|
+
"description": "Contains a Critical Common Vulnerability and Exposure (CVE).",
|
|
83
|
+
"props": {
|
|
84
|
+
"id": "Id",
|
|
85
|
+
"severity": "Severity",
|
|
86
|
+
"title": "Title",
|
|
87
|
+
"url": "URL"
|
|
88
|
+
},
|
|
89
|
+
"suggestion": "Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.",
|
|
90
|
+
"title": "Critical CVE",
|
|
91
|
+
"emoji": "⚠️"
|
|
92
|
+
},
|
|
93
|
+
"cve": {
|
|
94
|
+
"description": "Contains a high severity Common Vulnerability and Exposure (CVE).",
|
|
95
|
+
"props": {
|
|
96
|
+
"id": "Id",
|
|
97
|
+
"severity": "Severity",
|
|
98
|
+
"title": "Title",
|
|
99
|
+
"url": "URL",
|
|
100
|
+
"vulnerable_versions": "Vulnerable versions"
|
|
101
|
+
},
|
|
102
|
+
"suggestion": "Remove or replace dependencies that include known high severity CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.",
|
|
103
|
+
"title": "CVE",
|
|
104
|
+
"emoji": "⚠️"
|
|
105
|
+
},
|
|
106
|
+
"debugAccess": {
|
|
107
|
+
"description": "Uses debug, reflection and dynamic code execution features.",
|
|
108
|
+
"props": {
|
|
109
|
+
"module": "Module"
|
|
110
|
+
},
|
|
111
|
+
"suggestion": "Removing the use of debug will reduce the risk of any reflection and dynamic code execution.",
|
|
112
|
+
"title": "Debug access",
|
|
113
|
+
"emoji": "⚠️"
|
|
114
|
+
},
|
|
115
|
+
"deprecated": {
|
|
116
|
+
"description": "The maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.",
|
|
117
|
+
"props": {
|
|
118
|
+
"reason": "Reason"
|
|
119
|
+
},
|
|
120
|
+
"suggestion": "Research the state of the package and determine if there are non-deprecated versions that can be used, or if it should be replaced with a new, supported solution.",
|
|
121
|
+
"title": "Deprecated",
|
|
122
|
+
"emoji": "⚠️"
|
|
123
|
+
},
|
|
124
|
+
"deprecatedException": {
|
|
125
|
+
"description": "Contains a known deprecated SPDX license exception.",
|
|
126
|
+
"props": {
|
|
127
|
+
"comments": "Comments",
|
|
128
|
+
"exceptionId": "Exception id"
|
|
129
|
+
},
|
|
130
|
+
"suggestion": "Fix the license so that it no longer contains deprecated SPDX license exceptions.",
|
|
131
|
+
"title": "Deprecated SPDX exception",
|
|
132
|
+
"emoji": "⚠️"
|
|
133
|
+
},
|
|
134
|
+
"deprecatedLicense": {
|
|
135
|
+
"description": "License is deprecated which may have legal implications regarding the package's use.",
|
|
136
|
+
"props": {
|
|
137
|
+
"licenseId": "License id"
|
|
138
|
+
},
|
|
139
|
+
"suggestion": "Update or change the license to a well-known or updated license.",
|
|
140
|
+
"title": "Deprecated license",
|
|
141
|
+
"emoji": "⚠️"
|
|
142
|
+
},
|
|
143
|
+
"didYouMean": {
|
|
144
|
+
"description": "Package name is similar to other popular packages and may not be the package you want.",
|
|
145
|
+
"props": {
|
|
146
|
+
"alternatePackage": "Alternate package",
|
|
147
|
+
"downloads": "Downloads",
|
|
148
|
+
"downloadsRatio": "Download ratio",
|
|
149
|
+
"editDistance": "Edit distance"
|
|
150
|
+
},
|
|
151
|
+
"suggestion": "Use care when consuming similarly named packages and ensure that you did not intend to consume a different package. Malicious packages often publish using similar names as existing popular packages.",
|
|
152
|
+
"title": "Potential typo squat",
|
|
153
|
+
"emoji": "🧐"
|
|
154
|
+
},
|
|
155
|
+
"dynamicRequire": {
|
|
156
|
+
"description": "Dynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.",
|
|
157
|
+
"suggestion": "Packages should avoid dynamic imports when possible. Audit the use of dynamic require to ensure it is not executing malicious or vulnerable code.",
|
|
158
|
+
"title": "Dynamic require",
|
|
159
|
+
"emoji": "⚠️"
|
|
160
|
+
},
|
|
161
|
+
"emptyPackage": {
|
|
162
|
+
"description": "Package does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.",
|
|
163
|
+
"props": {
|
|
164
|
+
"linesOfCode": "Lines of code"
|
|
165
|
+
},
|
|
166
|
+
"suggestion": "Remove dependencies that do not export any code or functionality and ensure the package version includes all of the files it is supposed to.",
|
|
167
|
+
"title": "Empty package",
|
|
168
|
+
"emoji": "⚠️"
|
|
169
|
+
},
|
|
170
|
+
"envVars": {
|
|
171
|
+
"description": "Package accesses environment variables, which may be a sign of credential stuffing or data theft.",
|
|
172
|
+
"props": {
|
|
173
|
+
"envVars": "Environment variables"
|
|
174
|
+
},
|
|
175
|
+
"suggestion": "Packages should be clear about which environment variables they access, and care should be taken to ensure they only access environment variables they claim to.",
|
|
176
|
+
"title": "Environment variable access",
|
|
177
|
+
"emoji": "⚠️"
|
|
178
|
+
},
|
|
179
|
+
"extraneousDependency": {
|
|
180
|
+
"description": "Package optionally loads a dependency which is not specified within any of the package.json dependency fields. It may inadvertently be importing dependencies specified by other packages.",
|
|
181
|
+
"props": {
|
|
182
|
+
"name": "Name"
|
|
183
|
+
},
|
|
184
|
+
"suggestion": "Specify all optionally loaded dependencies in optionalDependencies within package.json.",
|
|
185
|
+
"title": "Extraneous dependency",
|
|
186
|
+
"emoji": "⚠️"
|
|
187
|
+
},
|
|
188
|
+
"fileDependency": {
|
|
189
|
+
"description": "Contains a dependency which resolves to a file. This can obfuscate analysis and serves no useful purpose.",
|
|
190
|
+
"props": {
|
|
191
|
+
"filePath": "File path",
|
|
192
|
+
"packageName": "Package name"
|
|
193
|
+
},
|
|
194
|
+
"suggestion": "Remove the dependency specified by a file resolution string from package.json and update any bare name imports that referenced it before to use relative path strings.",
|
|
195
|
+
"title": "File dependency",
|
|
196
|
+
"emoji": "⚠️"
|
|
197
|
+
},
|
|
198
|
+
"filesystemAccess": {
|
|
199
|
+
"description": "Accesses the file system, and could potentially read sensitive data.",
|
|
200
|
+
"props": {
|
|
201
|
+
"module": "Module"
|
|
202
|
+
},
|
|
203
|
+
"suggestion": "If a package must read the file system, clarify what it will read and ensure it reads only what it claims to. If appropriate, packages can leave file system access to consumers and operate on data passed to it instead.",
|
|
204
|
+
"title": "Filesystem access",
|
|
205
|
+
"emoji": "⚠️"
|
|
206
|
+
},
|
|
207
|
+
"gitDependency": {
|
|
208
|
+
"description": "Contains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.",
|
|
209
|
+
"props": {
|
|
210
|
+
"packageName": "Package name",
|
|
211
|
+
"url": "URL"
|
|
212
|
+
},
|
|
213
|
+
"suggestion": "Publish the git dependency to npm or a private package repository and consume it from there.",
|
|
214
|
+
"title": "Git dependency",
|
|
215
|
+
"emoji": "🍣"
|
|
216
|
+
},
|
|
217
|
+
"gitHubDependency": {
|
|
218
|
+
"description": "Contains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.",
|
|
219
|
+
"props": {
|
|
220
|
+
"commitsh": "Commit-ish (commit, branch, tag or version)",
|
|
221
|
+
"githubRepo": "Github repo",
|
|
222
|
+
"githubUser": "Github user",
|
|
223
|
+
"packageName": "Package name"
|
|
224
|
+
},
|
|
225
|
+
"suggestion": "Publish the GitHub dependency to npm or a private package repository and consume it from there.",
|
|
226
|
+
"title": "GitHub dependency",
|
|
227
|
+
"emoji": "⚠️"
|
|
228
|
+
},
|
|
229
|
+
"hasNativeCode": {
|
|
230
|
+
"description": "Contains native code which could be a vector to obscure malicious code, and generally decrease the likelihood of reproducible or reliable installs.",
|
|
231
|
+
"suggestion": "Ensure that native code bindings are expected. Consumers may consider pure JS and functionally similar alternatives to avoid the challenges and risks associated with native code bindings.",
|
|
232
|
+
"title": "Native code",
|
|
233
|
+
"emoji": "🫣"
|
|
234
|
+
},
|
|
235
|
+
"highEntropyStrings": {
|
|
236
|
+
"description": "Contains high entropy strings. This could be a sign of encrypted data, leaked secrets or obfuscated code.",
|
|
237
|
+
"suggestion": "Please inspect these strings to check if these strings are benign. Maintainers should clarify the purpose and existence of high entropy strings if there is a legitimate purpose.",
|
|
238
|
+
"title": "High entropy strings",
|
|
239
|
+
"emoji": "⚠️"
|
|
240
|
+
},
|
|
241
|
+
"homoglyphs": {
|
|
242
|
+
"description": "Contains unicode homoglyphs which can be used in supply chain confusion attacks.",
|
|
243
|
+
"suggestion": "Remove unicode homoglyphs if they are unnecessary, and audit their presence to confirm legitimate use.",
|
|
244
|
+
"title": "Unicode homoglyphs",
|
|
245
|
+
"emoji": "⚠️"
|
|
246
|
+
},
|
|
247
|
+
"httpDependency": {
|
|
248
|
+
"description": "Contains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.",
|
|
249
|
+
"props": {
|
|
250
|
+
"packageName": "Package name",
|
|
251
|
+
"url": "URL"
|
|
252
|
+
},
|
|
253
|
+
"suggestion": "Publish the HTTP URL dependency to npm or a private package repository and consume it from there.",
|
|
254
|
+
"title": "HTTP dependency",
|
|
255
|
+
"emoji": "🥩"
|
|
256
|
+
},
|
|
257
|
+
"installScripts": {
|
|
258
|
+
"description": "Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.",
|
|
259
|
+
"props": {
|
|
260
|
+
"script": "Script",
|
|
261
|
+
"source": "Source"
|
|
262
|
+
},
|
|
263
|
+
"suggestion": "Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead.",
|
|
264
|
+
"title": "Install scripts",
|
|
265
|
+
"emoji": "📜"
|
|
266
|
+
},
|
|
267
|
+
"gptMalware": {
|
|
268
|
+
"description": "Artificial intelligence has determined that this package likely contains malicious behavior",
|
|
269
|
+
"props": {
|
|
270
|
+
"notes": "Does this contain malware?"
|
|
271
|
+
},
|
|
272
|
+
"suggestion": "Packages which contain malware should never be installed. This package has been reported to npm for removal by socket",
|
|
273
|
+
"title": "AI detected malware",
|
|
274
|
+
"emoji": "🤖"
|
|
275
|
+
},
|
|
276
|
+
"invalidPackageJSON": {
|
|
277
|
+
"description": "Package has an invalid package.json and can cause installation problems if you try to use it.",
|
|
278
|
+
"suggestion": "Fix syntax errors in the invalid package.json and publish a new version with a valid package.json. Consumers can use npm overrides to force a version that does not have this problem if one exists.",
|
|
279
|
+
"title": "Invalid package.json",
|
|
280
|
+
"emoji": "🤒"
|
|
281
|
+
},
|
|
282
|
+
"invisibleChars": {
|
|
283
|
+
"description": "Source files contain invisible characters. This could indicate source obfuscation or a supply chain attack.",
|
|
284
|
+
"suggestion": "Remove invisible characters. If their use is justified, use their visible escaped counterparts.",
|
|
285
|
+
"title": "Invisible chars",
|
|
286
|
+
"emoji": "⚠️"
|
|
287
|
+
},
|
|
288
|
+
"licenseChange": {
|
|
289
|
+
"description": "Package license has recently changed.",
|
|
290
|
+
"props": {
|
|
291
|
+
"newLicenseId": "New license id",
|
|
292
|
+
"prevLicenseId": "Previous license id"
|
|
293
|
+
},
|
|
294
|
+
"suggestion": "License changes should be reviewed carefully to inform ongoing use. Packages should avoid making major changes to their license type.",
|
|
295
|
+
"title": "License change",
|
|
296
|
+
"emoji": "⚠️"
|
|
297
|
+
},
|
|
298
|
+
"licenseException": {
|
|
299
|
+
"description": "Contains an SPDX license exception.",
|
|
300
|
+
"props": {
|
|
301
|
+
"comments": "Comments",
|
|
302
|
+
"exceptionId": "Exception id"
|
|
303
|
+
},
|
|
304
|
+
"suggestion": "License exceptions should be carefully reviewed.",
|
|
305
|
+
"title": "License exception",
|
|
306
|
+
"emoji": "⚠️"
|
|
307
|
+
},
|
|
308
|
+
"longStrings": {
|
|
309
|
+
"description": "Contains long string literals, which may be a sign of obfuscated or packed code.",
|
|
310
|
+
"suggestion": "Avoid publishing or consuming obfuscated or bundled code. It makes dependencies difficult to audit and undermines the module resolution system.",
|
|
311
|
+
"title": "Long strings",
|
|
312
|
+
"emoji": "⚠️"
|
|
313
|
+
},
|
|
314
|
+
"missingTarball": {
|
|
315
|
+
"description": "This package is missing it's tarball. It could be removed from the npm registry or there may have been an error when publishing.",
|
|
316
|
+
"suggestion": "This package cannot be analyzed or installed due to missing data.",
|
|
317
|
+
"title": "Missing package tarball",
|
|
318
|
+
"emoji": "❔"
|
|
319
|
+
},
|
|
320
|
+
"majorRefactor": {
|
|
321
|
+
"description": "Package has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.",
|
|
322
|
+
"props": {
|
|
323
|
+
"changedPercent": "Change percentage",
|
|
324
|
+
"curSize": "Current amount of lines",
|
|
325
|
+
"linesChanged": "Lines changed",
|
|
326
|
+
"prevSize": "Previous amount of lines"
|
|
327
|
+
},
|
|
328
|
+
"suggestion": "Consider waiting before upgrading to see if any issues are discovered, or be prepared to scrutinize any bugs or subtle changes the major refactor may bring. Publishers my consider publishing beta versions of major refactors to limit disruption to parties interested in the new changes.",
|
|
329
|
+
"title": "Major refactor",
|
|
330
|
+
"emoji": "⚠️"
|
|
331
|
+
},
|
|
332
|
+
"malware": {
|
|
333
|
+
"description": "This package is malware. We have asked npm to remove it.",
|
|
334
|
+
"props": {
|
|
335
|
+
"id": "Id",
|
|
336
|
+
"note": "Note"
|
|
337
|
+
},
|
|
338
|
+
"title": "Known Malware",
|
|
339
|
+
"suggestion": "It is strongly recommended that malware is removed from your codebase.",
|
|
340
|
+
"emoji": "☠️"
|
|
341
|
+
},
|
|
342
|
+
"mildCVE": {
|
|
343
|
+
"description": "Contains a low severity Common Vulnerability and Exposure (CVE).",
|
|
344
|
+
"props": {
|
|
345
|
+
"id": "Id",
|
|
346
|
+
"severity": "Severity",
|
|
347
|
+
"title": "Title",
|
|
348
|
+
"url": "URL"
|
|
349
|
+
},
|
|
350
|
+
"suggestion": "Remove or replace dependencies that include known low severity CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.",
|
|
351
|
+
"title": "Mild CVE",
|
|
352
|
+
"emoji": "⚠️"
|
|
353
|
+
},
|
|
354
|
+
"minifiedFile": {
|
|
355
|
+
"description": "This package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.",
|
|
356
|
+
"props": {
|
|
357
|
+
"confidence": "Confidence"
|
|
358
|
+
},
|
|
359
|
+
"suggestion": "In many cases minified code is harmless, however minified code can be used to hide a supply chain attack. Consider not shipping minified code on npm.",
|
|
360
|
+
"title": "Minified code",
|
|
361
|
+
"emoji": "⚠️"
|
|
362
|
+
},
|
|
363
|
+
"missingAuthor": {
|
|
364
|
+
"description": "The package was published by an npm account that no longer exists.",
|
|
365
|
+
"suggestion": "Packages should have active and identified authors.",
|
|
366
|
+
"title": "Non-existent author",
|
|
367
|
+
"emoji": "🫥"
|
|
368
|
+
},
|
|
369
|
+
"missingDependency": {
|
|
370
|
+
"description": "A required dependency is not declared in package.json and may prevent the package from working.",
|
|
371
|
+
"props": {
|
|
372
|
+
"name": "Name"
|
|
373
|
+
},
|
|
374
|
+
"suggestion": "The package should define the missing dependency inside of package.json and publish a new version. Consumers may have to install the missing dependency themselves as long as the dependency remains missing. If the dependency is optional, add it to optionalDependencies and handle the missing case.",
|
|
375
|
+
"title": "Missing dependency",
|
|
376
|
+
"emoji": "⚠️"
|
|
377
|
+
},
|
|
378
|
+
"missingLicense": {
|
|
379
|
+
"description": "Package does not have a license and consumption legal status is unknown.",
|
|
380
|
+
"suggestion": "A new version of the package should be published that includes a valid SPDX license in a license file, pacakge.json license field or mentioned in the README.",
|
|
381
|
+
"title": "Missing license",
|
|
382
|
+
"emoji": "⚠️"
|
|
383
|
+
},
|
|
384
|
+
"mixedLicense": {
|
|
385
|
+
"description": "Package contains multiple licenses.",
|
|
386
|
+
"props": {
|
|
387
|
+
"licenseId": "License Id"
|
|
388
|
+
},
|
|
389
|
+
"suggestion": "A new version of the package should be published that includes a single license. Consumers may seek clarification from the package author. Ensure that the license details are consistent across the LICENSE file, package.json license field and license details mentioned in the README.",
|
|
390
|
+
"title": "Mixed license",
|
|
391
|
+
"emoji": "⚠️"
|
|
392
|
+
},
|
|
393
|
+
"modifiedException": {
|
|
394
|
+
"description": "Package contains a modified version of an SPDX license exception. Please read carefully before using this code.",
|
|
395
|
+
"props": {
|
|
396
|
+
"comments": "Comments",
|
|
397
|
+
"exceptionId": "Exception id",
|
|
398
|
+
"similarity": "Similarity"
|
|
399
|
+
},
|
|
400
|
+
"suggestion": "Packages should avoid making modifications to standard license exceptions.",
|
|
401
|
+
"title": "Modified license exception",
|
|
402
|
+
"emoji": "⚠️"
|
|
403
|
+
},
|
|
404
|
+
"modifiedLicense": {
|
|
405
|
+
"description": "Package contains a modified version of an SPDX license. Please read carefully before using this code.",
|
|
406
|
+
"props": {
|
|
407
|
+
"licenseId": "License id",
|
|
408
|
+
"similarity": "Similarity"
|
|
409
|
+
},
|
|
410
|
+
"suggestion": "Packages should avoid making modifications to standard licenses.",
|
|
411
|
+
"title": "Modified license",
|
|
412
|
+
"emoji": "⚠️"
|
|
413
|
+
},
|
|
414
|
+
"networkAccess": {
|
|
415
|
+
"description": "This module accesses the network.",
|
|
416
|
+
"props": {
|
|
417
|
+
"module": "Module"
|
|
418
|
+
},
|
|
419
|
+
"suggestion": "Packages should remove all network access that isn't functionally unnecessary. Consumers should audit network access to ensure legitimate use.",
|
|
420
|
+
"title": "Network access",
|
|
421
|
+
"emoji": "⚠️"
|
|
422
|
+
},
|
|
423
|
+
"newAuthor": {
|
|
424
|
+
"description": "A new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.",
|
|
425
|
+
"props": {
|
|
426
|
+
"newAuthor": "New author",
|
|
427
|
+
"prevAuthor": "Previous author"
|
|
428
|
+
},
|
|
429
|
+
"suggestion": "Scrutinize new collaborator additions to packages because they now have the ability to publish code into your dependency tree. Packages should avoid frequent or unnecessary additions or changes to publishing rights.",
|
|
430
|
+
"title": "New author",
|
|
431
|
+
"emoji": "⚠️"
|
|
432
|
+
},
|
|
433
|
+
"noAuthorData": {
|
|
434
|
+
"description": "Package does not specify a list of contributors or an author in package.json.",
|
|
435
|
+
"suggestion": "Add a author field or contributors array to package.json.",
|
|
436
|
+
"title": "No contributors or author data",
|
|
437
|
+
"emoji": "⚠️"
|
|
438
|
+
},
|
|
439
|
+
"noBugTracker": {
|
|
440
|
+
"description": "Package does not have a linked bug tracker in package.json.",
|
|
441
|
+
"suggestion": "Add a bugs field to package.json. https://docs.npmjs.com/cli/v8/configuring-npm/package-json#bugs",
|
|
442
|
+
"title": "No bug tracker",
|
|
443
|
+
"emoji": "⚠️"
|
|
444
|
+
},
|
|
445
|
+
"noREADME": {
|
|
446
|
+
"description": "Package does not have a README. This may indicate a failed publish or a low quality package.",
|
|
447
|
+
"suggestion": "Add a README to to the package and publish a new version.",
|
|
448
|
+
"title": "No README",
|
|
449
|
+
"emoji": "⚠️"
|
|
450
|
+
},
|
|
451
|
+
"noRepository": {
|
|
452
|
+
"description": "Package does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.",
|
|
453
|
+
"suggestion": "Add a repository field to package.json. https://docs.npmjs.com/cli/v8/configuring-npm/package-json#repository",
|
|
454
|
+
"title": "No repository",
|
|
455
|
+
"emoji": "⚠️"
|
|
456
|
+
},
|
|
457
|
+
"noTests": {
|
|
458
|
+
"description": "Package does not have any tests. This is a strong signal of a poorly maintained or low quality package.",
|
|
459
|
+
"suggestion": "Add tests and publish a new version of the package. Consumers may look for an alternative package with better testing.",
|
|
460
|
+
"title": "No tests",
|
|
461
|
+
"emoji": "⚠️"
|
|
462
|
+
},
|
|
463
|
+
"noV1": {
|
|
464
|
+
"description": "Package is not semver >=1. This means it is not stable and does not support ^ ranges.",
|
|
465
|
+
"suggestion": "If the package sees any general use, it should begin releasing at version 1.0.0 or later to benefit from semver.",
|
|
466
|
+
"title": "No v1",
|
|
467
|
+
"emoji": "⚠️"
|
|
468
|
+
},
|
|
469
|
+
"noWebsite": {
|
|
470
|
+
"description": "Package does not have a website.",
|
|
471
|
+
"suggestion": "Add a homepage field to package.json. https://docs.npmjs.com/cli/v8/configuring-npm/package-json#homepage",
|
|
472
|
+
"title": "No website",
|
|
473
|
+
"emoji": "⚠️"
|
|
474
|
+
},
|
|
475
|
+
"nonFSFLicense": {
|
|
476
|
+
"description": "Package has a non-FSF-approved license.",
|
|
477
|
+
"props": {
|
|
478
|
+
"licenseId": "License id"
|
|
479
|
+
},
|
|
480
|
+
"title": "Non FSF license",
|
|
481
|
+
"emoji": "⚠️"
|
|
482
|
+
},
|
|
483
|
+
"nonOSILicense": {
|
|
484
|
+
"description": "Package has a non-OSI-approved license.",
|
|
485
|
+
"props": {
|
|
486
|
+
"licenseId": "License id"
|
|
487
|
+
},
|
|
488
|
+
"title": "Non OSI license",
|
|
489
|
+
"emoji": "⚠️"
|
|
490
|
+
},
|
|
491
|
+
"nonSPDXLicense": {
|
|
492
|
+
"description": "Package contains a non-standard license somewhere. Please read carefully before using.",
|
|
493
|
+
"suggestion": "Package should adopt a standard SPDX license consistently across all license locations (LICENSE files, package.json license fields, and READMEs).",
|
|
494
|
+
"title": "Non SPDX license",
|
|
495
|
+
"emoji": "⚠️"
|
|
496
|
+
},
|
|
497
|
+
"notice": {
|
|
498
|
+
"description": "Package contains a legal notice. This could increase your exposure to legal risk when using this project.",
|
|
499
|
+
"title": "Legal notice",
|
|
500
|
+
"emoji": "⚠️"
|
|
501
|
+
},
|
|
502
|
+
"obfuscatedFile": {
|
|
503
|
+
"description": "Obfuscated files are intentionally packed to hide their behavior. This could be a sign of malware",
|
|
504
|
+
"props": {
|
|
505
|
+
"confidence": "Confidence"
|
|
506
|
+
},
|
|
507
|
+
"suggestion": "Packages should not obfuscate their code. Consider not using packages with obfuscated code",
|
|
508
|
+
"title": "Obfuscated code",
|
|
509
|
+
"emoji": "⚠️"
|
|
510
|
+
},
|
|
511
|
+
"obfuscatedRequire": {
|
|
512
|
+
"description": "Package accesses dynamic properties of require and may be obfuscating code execution.",
|
|
513
|
+
"suggestion": "The package should not access dynamic properties of module. Instead use import or require directly.",
|
|
514
|
+
"title": "Obfuscated require",
|
|
515
|
+
"emoji": "⚠️"
|
|
516
|
+
},
|
|
517
|
+
"peerDependency": {
|
|
518
|
+
"description": "Package specifies peer dependencies in package.json.",
|
|
519
|
+
"props": {
|
|
520
|
+
"name": "Name"
|
|
521
|
+
},
|
|
522
|
+
"suggestion": "Peer dependencies are fragile and can cause major problems across version changes. Be careful when updating this dependency and its peers.",
|
|
523
|
+
"title": "Peer dependency",
|
|
524
|
+
"emoji": "⚠️"
|
|
525
|
+
},
|
|
526
|
+
"semverAnomaly": {
|
|
527
|
+
"description": "Package semver skipped several versions, this could indicate a dependency confusion attack or indicate the intention of disruptive breaking changes or major priority shifts for the project.",
|
|
528
|
+
"props": {
|
|
529
|
+
"newVersion": "New version",
|
|
530
|
+
"prevVersion": "Previous version"
|
|
531
|
+
},
|
|
532
|
+
"suggestion": "Packages should follow semantic versions conventions by not skipping subsequent version numbers. Consumers should research the purpose of the skipped version number.",
|
|
533
|
+
"title": "Semver anomaly",
|
|
534
|
+
"emoji": "⚠️"
|
|
535
|
+
},
|
|
536
|
+
"shellAccess": {
|
|
537
|
+
"description": "This module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.",
|
|
538
|
+
"props": {
|
|
539
|
+
"module": "Module"
|
|
540
|
+
},
|
|
541
|
+
"suggestion": "Packages should avoid accessing the shell which can reduce portability, and make it easier for malicious shell access to be introduced.",
|
|
542
|
+
"title": "Shell access",
|
|
543
|
+
"emoji": "⚠️"
|
|
544
|
+
},
|
|
545
|
+
"shellScriptOverride": {
|
|
546
|
+
"description": "This package re-exports a well known shell command via an npm bin script. This is possibly a supply chain attack",
|
|
547
|
+
"props": {
|
|
548
|
+
"binScript": "Bin script"
|
|
549
|
+
},
|
|
550
|
+
"suggestion": "Packages should not export bin scripts which conflict with well known shell commands",
|
|
551
|
+
"title": "Bin script shell injection",
|
|
552
|
+
"emoji": "🦀"
|
|
553
|
+
},
|
|
554
|
+
"suspiciousString": {
|
|
555
|
+
"description": "This package contains suspicious text patterns which are commonly associated with bad behavior",
|
|
556
|
+
"props": {
|
|
557
|
+
"explanation": "Explanation",
|
|
558
|
+
"pattern": "Pattern"
|
|
559
|
+
},
|
|
560
|
+
"suggestion": "The package code should be reviewed before installing",
|
|
561
|
+
"title": "Suspicious strings",
|
|
562
|
+
"emoji": "⚠️"
|
|
563
|
+
},
|
|
564
|
+
"telemetry": {
|
|
565
|
+
"description": "This package contains telemetry which tracks you.",
|
|
566
|
+
"props": {
|
|
567
|
+
"id": "Id",
|
|
568
|
+
"note": "Note"
|
|
569
|
+
},
|
|
570
|
+
"title": "Telemetry",
|
|
571
|
+
"emoji": "📞"
|
|
572
|
+
},
|
|
573
|
+
"trivialPackage": {
|
|
574
|
+
"description": "Packages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.",
|
|
575
|
+
"props": {
|
|
576
|
+
"linesOfCode": "Lines of code"
|
|
577
|
+
},
|
|
578
|
+
"suggestion": "Removing this package as a dependency and implementing its logic will reduce supply chain risk.",
|
|
579
|
+
"title": "Trivial Package",
|
|
580
|
+
"emoji": "⚠️"
|
|
581
|
+
},
|
|
582
|
+
"troll": {
|
|
583
|
+
"description": "This package is a joke, parody, or includes undocumented or hidden behavior unrelated to its primary function.",
|
|
584
|
+
"props": {
|
|
585
|
+
"id": "Id",
|
|
586
|
+
"note": "Note"
|
|
587
|
+
},
|
|
588
|
+
"title": "Protestware/Troll package",
|
|
589
|
+
"emoji": "🧌"
|
|
590
|
+
},
|
|
591
|
+
"typeModuleCompatibility": {
|
|
592
|
+
"description": "Package is CommonJS, but has a dependency which is type: \"module\". The two are likely incompatible.",
|
|
593
|
+
"suggestion": "The package needs to switch to dynamic import on the esmodule dependency, or convert to esm itself. Consumers may experience errors resulting from this incompatibility.",
|
|
594
|
+
"title": "CommonJS depending on ESModule",
|
|
595
|
+
"emoji": "⚠️"
|
|
596
|
+
},
|
|
597
|
+
"uncaughtOptionalDependency": {
|
|
598
|
+
"description": "Package uses an optional dependency without handling a missing dependency exception. If you install it without the optional dependencies then it could cause runtime errors.",
|
|
599
|
+
"props": {
|
|
600
|
+
"name": "Name"
|
|
601
|
+
},
|
|
602
|
+
"suggestion": "Package should handle the loading of the dependency when it is not present, or convert the optional dependency into a regular dependency.",
|
|
603
|
+
"title": "Uncaught optional dependency",
|
|
604
|
+
"emoji": "⚠️"
|
|
605
|
+
},
|
|
606
|
+
"unclearLicense": {
|
|
607
|
+
"description": "Package contains a reference to a license without a matching LICENSE file.",
|
|
608
|
+
"props": {
|
|
609
|
+
"possibleLicenseId": "Possible license id"
|
|
610
|
+
},
|
|
611
|
+
"suggestion": "Add a LICENSE file that matches the license field in package.json. https://docs.npmjs.com/cli/v8/configuring-npm/package-json#license",
|
|
612
|
+
"title": "Unclear license",
|
|
613
|
+
"emoji": "⚠️"
|
|
614
|
+
},
|
|
615
|
+
"unmaintained": {
|
|
616
|
+
"description": "Package has not been updated in more than a year and may be unmaintained. Problems with the package may go unaddressed.",
|
|
617
|
+
"props": {
|
|
618
|
+
"lastPublish": "Last publish"
|
|
619
|
+
},
|
|
620
|
+
"suggestion": "Package should publish periodic maintenance releases if they are maintained, or deprecate if they have no intention in further maintenance.",
|
|
621
|
+
"title": "Unmaintained",
|
|
622
|
+
"emoji": "⚠️"
|
|
623
|
+
},
|
|
624
|
+
"unpublished": {
|
|
625
|
+
"description": "Package version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.",
|
|
626
|
+
"props": {
|
|
627
|
+
"version": "The version that was not found"
|
|
628
|
+
},
|
|
629
|
+
"suggestion": "Packages can be removed from the registry by manually un-publishing, a security issue removal, or may simply never have been published to the registry. Reliance on these packages will cause problem when they are not found.",
|
|
630
|
+
"title": "Unpublished package",
|
|
631
|
+
"emoji": "⚠️"
|
|
632
|
+
},
|
|
633
|
+
"unresolvedRequire": {
|
|
634
|
+
"description": "Package imports a file which does not exist and may not work as is. It could also be importing a file that will be created at runtime which could be a vector for running malicious code.",
|
|
635
|
+
"suggestion": "Fix imports so that they require declared dependencies or existing files.",
|
|
636
|
+
"title": "Unresolved require",
|
|
637
|
+
"emoji": "🕵️"
|
|
638
|
+
},
|
|
639
|
+
"unsafeCopyright": {
|
|
640
|
+
"description": "Package contains a copyright but no license. Using this package may expose you to legal risk.",
|
|
641
|
+
"suggestion": "Clarify the license type by adding a license field to package.json and a LICENSE file.",
|
|
642
|
+
"title": "Unsafe copyright",
|
|
643
|
+
"emoji": "⚠️"
|
|
644
|
+
},
|
|
645
|
+
"unstableOwnership": {
|
|
646
|
+
"description": "A new collaborator has begun publishing package versions. Package stability and security risk may be elevated.",
|
|
647
|
+
"props": {
|
|
648
|
+
"author": "Author"
|
|
649
|
+
},
|
|
650
|
+
"suggestion": "Try to reduce the amount of authors you depend on to reduce the risk to malicious actors gaining access to your supply chain. Packages should remove inactive collaborators with publishing rights from packages on npm.",
|
|
651
|
+
"title": "Unstable ownership",
|
|
652
|
+
"emoji": "⚠️"
|
|
653
|
+
},
|
|
654
|
+
"unusedDependency": {
|
|
655
|
+
"description": "Package has unused dependencies. This package depends on code that it does not use. This can increase the attack surface for malware and slow down installation.",
|
|
656
|
+
"props": {
|
|
657
|
+
"name": "Name",
|
|
658
|
+
"version": "Version"
|
|
659
|
+
},
|
|
660
|
+
"suggestion": "Packages should only specify dependencies that they use directly.",
|
|
661
|
+
"title": "Unused dependency",
|
|
662
|
+
"emoji": "⚠️"
|
|
663
|
+
},
|
|
664
|
+
"urlStrings": {
|
|
665
|
+
"description": "Package contains fragments of external URLs or IP addresses, which may indicate that it covertly exfiltrates data.",
|
|
666
|
+
"props": {
|
|
667
|
+
"urlFragment": "URL Fragment"
|
|
668
|
+
},
|
|
669
|
+
"suggestion": "Avoid using packages that make connections to the network, since this helps to leak data.",
|
|
670
|
+
"title": "URL strings",
|
|
671
|
+
"emoji": "⚠️"
|
|
672
|
+
},
|
|
673
|
+
"usesEval": {
|
|
674
|
+
"description": "Package uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.",
|
|
675
|
+
"props": {
|
|
676
|
+
"evalType": "Eval type"
|
|
677
|
+
},
|
|
678
|
+
"suggestion": "Avoid packages that use eval, since this could potentially execute any code.",
|
|
679
|
+
"title": "Uses eval",
|
|
680
|
+
"emoji": "⚠️"
|
|
681
|
+
},
|
|
682
|
+
"zeroWidth": {
|
|
683
|
+
"description": "Package files contain zero width unicode characters. This could indicate a supply chain attack.",
|
|
684
|
+
"suggestion": "Packages should remove unnecessary zero width unicode characters and use their visible counterparts.",
|
|
685
|
+
"title": "Zero width unicode chars",
|
|
686
|
+
"emoji": "⚠️"
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "CLI tool for Socket.dev",
|
|
5
5
|
"homepage": "http://github.com/SocketDev/socket-cli-js",
|
|
6
6
|
"repository": {
|
|
@@ -25,7 +25,10 @@
|
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
27
|
"cli.js",
|
|
28
|
-
"lib/**/*.js"
|
|
28
|
+
"lib/**/*.js",
|
|
29
|
+
"lib/**/*.json",
|
|
30
|
+
"lib/**/*.cjs",
|
|
31
|
+
"lib/shadow/**"
|
|
29
32
|
],
|
|
30
33
|
"scripts": {
|
|
31
34
|
"echo": "echo $PATH",
|