@socketsecurity/cli 0.11.0 → 0.12.0
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/README.md +22 -22
- package/bin/npm +2 -0
- package/bin/npx +2 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +3928 -0
- package/dist/errors.d.ts +7 -0
- package/dist/link.d.ts +2 -0
- package/dist/link.js +45 -0
- package/dist/npm-cli.d.ts +2 -0
- package/dist/npm-cli.js +84 -0
- package/dist/npm-injection.d.ts +1 -0
- package/dist/npm-injection.js +913 -0
- package/dist/npm-injection2.d.ts +25 -0
- package/dist/npm-injection2.js +899 -0
- package/dist/npx-cli.d.ts +2 -0
- package/dist/npx-cli.js +60 -0
- package/dist/path-resolve.d.ts +12 -0
- package/dist/path-resolve.js +139 -0
- package/dist/sdk.d.ts +27 -0
- package/dist/sdk.js +224 -0
- package/dist/settings.d.ts +9 -0
- package/dist/type-helpers.d.ts +3 -0
- package/dist/vendor.js +25421 -0
- package/package.json +108 -52
- package/{lib/shadow/translations.json → translations.json} +20 -20
- package/cli.js +0 -72
- package/lib/commands/audit-log/index.js +0 -162
- package/lib/commands/cdxgen/index.js +0 -211
- package/lib/commands/dependencies/index.js +0 -150
- package/lib/commands/index.js +0 -15
- package/lib/commands/info/index.js +0 -287
- package/lib/commands/login/index.js +0 -170
- package/lib/commands/logout/index.js +0 -35
- package/lib/commands/npm/index.js +0 -27
- package/lib/commands/npx/index.js +0 -22
- package/lib/commands/organizations/index.js +0 -81
- package/lib/commands/raw-npm/index.js +0 -59
- package/lib/commands/raw-npx/index.js +0 -59
- package/lib/commands/report/create.js +0 -251
- package/lib/commands/report/index.js +0 -24
- package/lib/commands/report/view.js +0 -176
- package/lib/commands/repos/create.js +0 -166
- package/lib/commands/repos/delete.js +0 -93
- package/lib/commands/repos/index.js +0 -30
- package/lib/commands/repos/list.js +0 -170
- package/lib/commands/repos/update.js +0 -166
- package/lib/commands/repos/view.js +0 -128
- package/lib/commands/scan/create.js +0 -245
- package/lib/commands/scan/delete.js +0 -112
- package/lib/commands/scan/index.js +0 -30
- package/lib/commands/scan/list.js +0 -192
- package/lib/commands/scan/metadata.js +0 -113
- package/lib/commands/scan/stream.js +0 -115
- package/lib/commands/wrapper/index.js +0 -199
- package/lib/flags/command.js +0 -14
- package/lib/flags/index.js +0 -3
- package/lib/flags/output.js +0 -16
- package/lib/flags/validation.js +0 -14
- package/lib/shadow/bin/npm +0 -2
- package/lib/shadow/bin/npx +0 -2
- package/lib/shadow/link.cjs +0 -50
- package/lib/shadow/npm-cli.cjs +0 -27
- package/lib/shadow/npm-injection.cjs +0 -649
- package/lib/shadow/npx-cli.cjs +0 -27
- package/lib/shadow/package.json +0 -3
- package/lib/shadow/tty-server.cjs +0 -222
- package/lib/shadow/update-notifier.mjs +0 -3
- package/lib/utils/api-helpers.js +0 -42
- package/lib/utils/chalk-markdown.js +0 -125
- package/lib/utils/errors.js +0 -14
- package/lib/utils/flags.js +0 -27
- package/lib/utils/format-issues.js +0 -99
- package/lib/utils/formatting.js +0 -47
- package/lib/utils/issue-rules.cjs +0 -180
- package/lib/utils/meow-with-subcommands.js +0 -87
- package/lib/utils/misc.js +0 -61
- package/lib/utils/path-resolve.js +0 -204
- package/lib/utils/sdk.js +0 -99
- package/lib/utils/settings.js +0 -69
- package/lib/utils/type-helpers.cjs +0 -13
- package/lib/utils/update-notifier.js +0 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "CLI tool for Socket.dev",
|
|
5
5
|
"homepage": "http://github.com/SocketDev/socket-cli-js",
|
|
6
6
|
"repository": {
|
|
@@ -14,104 +14,160 @@
|
|
|
14
14
|
"url": "https://socket.dev"
|
|
15
15
|
},
|
|
16
16
|
"license": "MIT",
|
|
17
|
-
"type": "module",
|
|
18
17
|
"bin": {
|
|
19
|
-
"socket": "cli.js",
|
|
20
|
-
"socket-npm": "
|
|
21
|
-
"socket-npx": "
|
|
18
|
+
"socket": "dist/cli.js",
|
|
19
|
+
"socket-npm": "dist/npm-cli.js",
|
|
20
|
+
"socket-npx": "dist/npx-cli.js"
|
|
22
21
|
},
|
|
23
22
|
"files": [
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"lib/**/*.cjs",
|
|
28
|
-
"lib/shadow/**"
|
|
23
|
+
"bin/**",
|
|
24
|
+
"dist/**",
|
|
25
|
+
"translations.json"
|
|
29
26
|
],
|
|
30
27
|
"dependencies": {
|
|
31
28
|
"@apideck/better-ajv-errors": "^0.3.6",
|
|
32
|
-
"@cyclonedx/cdxgen": "^10.
|
|
33
|
-
"@inquirer/
|
|
29
|
+
"@cyclonedx/cdxgen": "^10.9.4",
|
|
30
|
+
"@inquirer/prompts": "^5.3.2",
|
|
34
31
|
"@socketsecurity/config": "^2.1.3",
|
|
35
32
|
"@socketsecurity/sdk": "^1.2.0",
|
|
36
|
-
"
|
|
33
|
+
"ansi-align": "^3.0.1",
|
|
34
|
+
"blessed": "^0.1.81",
|
|
35
|
+
"blessed-contrib": "^4.11.0",
|
|
37
36
|
"chalk-table": "^1.0.2",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
37
|
+
"cli-boxes": "^3.0.0",
|
|
38
|
+
"cli-spinners": "^2.9.2",
|
|
39
|
+
"cross-spawn": "^7.0.3",
|
|
40
|
+
"dot-prop": "^9.0.0",
|
|
41
|
+
"eastasianwidth": "^0.2.0",
|
|
42
|
+
"emoji-regex": "^10.3.0",
|
|
43
|
+
"fast-glob": "^3.3.2",
|
|
44
|
+
"graceful-fs": "^4.2.6",
|
|
40
45
|
"hpagent": "^1.2.0",
|
|
41
46
|
"ignore": "^5.3.1",
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"meow": "^13.2.0",
|
|
47
|
-
"open": "^10.1.0",
|
|
48
|
-
"ora": "^8.0.1",
|
|
47
|
+
"ini": "4.1.3",
|
|
48
|
+
"node-domexception": "^1.0.0",
|
|
49
|
+
"onetime": "^5.1.0",
|
|
50
|
+
"pacote": "^18.0.6",
|
|
49
51
|
"pony-cause": "^2.1.11",
|
|
50
|
-
"
|
|
52
|
+
"rc": "1.2.8",
|
|
53
|
+
"registry-auth-token": "^5.0.2",
|
|
54
|
+
"semver": "^7.6.2",
|
|
55
|
+
"signal-exit": "^4.1.0",
|
|
56
|
+
"supports-hyperlinks": "^2.2.0",
|
|
51
57
|
"synp": "^1.9.13",
|
|
52
|
-
"terminal-link": "^3.0.0",
|
|
53
|
-
"update-notifier": "^7.0.0",
|
|
54
58
|
"which": "^4.0.0",
|
|
59
|
+
"write-file-atomic": "^5.0.1",
|
|
55
60
|
"yargs-parser": "^21.1.1"
|
|
56
61
|
},
|
|
57
62
|
"devDependencies": {
|
|
63
|
+
"@babel/core": "^7.24.9",
|
|
64
|
+
"@babel/plugin-proposal-export-default-from": "^7.24.7",
|
|
65
|
+
"@babel/plugin-transform-export-namespace-from": "^7.24.7",
|
|
66
|
+
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
|
|
67
|
+
"@babel/plugin-transform-runtime": "^7.24.7",
|
|
68
|
+
"@babel/preset-env": "^7.24.8",
|
|
69
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
70
|
+
"@babel/runtime": "^7.24.8",
|
|
71
|
+
"@eslint/compat": "^1.1.1",
|
|
72
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
73
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
74
|
+
"@rollup/plugin-replace": "^5.0.7",
|
|
75
|
+
"@rollup/pluginutils": "^5.1.0",
|
|
58
76
|
"@socketsecurity/eslint-config": "^5.0.1",
|
|
59
77
|
"@tsconfig/node20": "^20.1.4",
|
|
60
|
-
"@types/
|
|
61
|
-
"@types/
|
|
62
|
-
"@types/inquirer": "^9.0.7",
|
|
63
|
-
"@types/micromatch": "^4.0.7",
|
|
64
|
-
"@types/mocha": "^10.0.6",
|
|
78
|
+
"@types/micromatch": "^4.0.9",
|
|
79
|
+
"@types/mocha": "^10.0.7",
|
|
65
80
|
"@types/mock-fs": "^4.13.4",
|
|
66
|
-
"@types/node": "^20.12
|
|
81
|
+
"@types/node": "^20.14.12",
|
|
67
82
|
"@types/npm": "^7.19.3",
|
|
68
|
-
"@types/npmcli__arborist": "^5.6.
|
|
69
|
-
"@types/prompts": "^2.4.9",
|
|
83
|
+
"@types/npmcli__arborist": "^5.6.9",
|
|
70
84
|
"@types/update-notifier": "^6.0.8",
|
|
71
85
|
"@types/which": "^3.0.4",
|
|
72
86
|
"@types/yargs-parser": "^21.0.3",
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
87
|
+
"@typescript-eslint/eslint-plugin": "^7.17.0",
|
|
74
88
|
"@typescript-eslint/parser": "7.10.0",
|
|
75
89
|
"c8": "^10.1.2",
|
|
76
|
-
"
|
|
90
|
+
"chalk": "^5.3.0",
|
|
91
|
+
"esbuild": "^0.23.0",
|
|
77
92
|
"eslint": "^8.56.0",
|
|
93
|
+
"eslint-config-prettier": "^9.1.0",
|
|
78
94
|
"eslint-config-standard": "^17.1.0",
|
|
79
95
|
"eslint-config-standard-jsx": "^11.0.0",
|
|
80
96
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
97
|
+
"eslint-plugin-depend": "^0.11.0",
|
|
81
98
|
"eslint-plugin-import": "^2.29.1",
|
|
82
|
-
"eslint-plugin-jsdoc": "^48.2.7",
|
|
83
99
|
"eslint-plugin-n": "^16.6.2",
|
|
84
|
-
"eslint-plugin-promise": "^6.
|
|
85
|
-
"eslint-plugin-react": "^7.34.2",
|
|
86
|
-
"eslint-plugin-react-hooks": "^4.6.2",
|
|
100
|
+
"eslint-plugin-promise": "^6.6.0",
|
|
87
101
|
"eslint-plugin-unicorn": "^48.0.1",
|
|
88
|
-
"
|
|
89
|
-
"
|
|
102
|
+
"execa": "^9.3.0",
|
|
103
|
+
"globby": "^14.0.2",
|
|
104
|
+
"husky": "^9.1.4",
|
|
105
|
+
"is-interactive": "^2.0.0",
|
|
106
|
+
"is-unicode-supported": "^2.0.0",
|
|
107
|
+
"knip": "^5.27.0",
|
|
108
|
+
"magic-string": "^0.30.10",
|
|
109
|
+
"meow": "^13.2.0",
|
|
90
110
|
"mock-fs": "^5.2.0",
|
|
91
111
|
"nock": "^13.5.4",
|
|
92
|
-
"npm-run-all2": "^6.2.
|
|
93
|
-
"
|
|
94
|
-
"
|
|
112
|
+
"npm-run-all2": "^6.2.2",
|
|
113
|
+
"open": "^10.1.0",
|
|
114
|
+
"ora": "^8.0.1",
|
|
115
|
+
"prettier": "3.3.3",
|
|
116
|
+
"read-package-up": "^11.0.0",
|
|
117
|
+
"rollup": "4.19.0",
|
|
118
|
+
"rollup-plugin-ts": "^3.4.5",
|
|
119
|
+
"tap": "^21.0.0",
|
|
120
|
+
"terminal-link": "^3.0.0",
|
|
121
|
+
"type-coverage": "^2.29.1",
|
|
122
|
+
"typescript": "~5.4.5",
|
|
123
|
+
"unplugin-purge-polyfills": "^0.0.4",
|
|
124
|
+
"update-notifier": "^7.2.0",
|
|
125
|
+
"validate-npm-package-name": "^5.0.1"
|
|
95
126
|
},
|
|
96
127
|
"overrides": {
|
|
97
128
|
"@cyclonedx/cdxgen": {
|
|
98
|
-
"packageurl-js": "https://registry.npmjs.org/@jdalton/packageurl-js/-/packageurl-js-1.
|
|
99
|
-
}
|
|
129
|
+
"packageurl-js": "https://registry.npmjs.org/@jdalton/packageurl-js/-/packageurl-js-1.5.0.tgz"
|
|
130
|
+
},
|
|
131
|
+
"array-includes": "npm:@nolyfill/array-includes@^1",
|
|
132
|
+
"array.prototype.findlast": "npm:@nolyfill/array.prototype.findlast@^1",
|
|
133
|
+
"array.prototype.findlastindex": "npm:@nolyfill/array.prototype.findlastindex@^1",
|
|
134
|
+
"array.prototype.flat": "npm:@nolyfill/array.prototype.flat@^1",
|
|
135
|
+
"array.prototype.flatmap": "npm:@nolyfill/array.prototype.flatmap@^1",
|
|
136
|
+
"array.prototype.tosorted": "npm:@nolyfill/array.prototype.tosorted@^1",
|
|
137
|
+
"es-iterator-helpers": "npm:@nolyfill/es-iterator-helpers@^1",
|
|
138
|
+
"globalthis": "npm:@nolyfill/globalthis@^1",
|
|
139
|
+
"hasown": "npm:@nolyfill/hasown@^1",
|
|
140
|
+
"is-core-module": "npm:@nolyfill/is-core-module@^1",
|
|
141
|
+
"object.assign": "npm:@nolyfill/object.assign@^1",
|
|
142
|
+
"object.entries": "npm:@nolyfill/object.entries@^1",
|
|
143
|
+
"object.fromentries": "npm:@nolyfill/object.fromentries@^1",
|
|
144
|
+
"object.groupby": "npm:@nolyfill/object.groupby@^1",
|
|
145
|
+
"object.values": "npm:@nolyfill/object.values@^1",
|
|
146
|
+
"side-channel": "npm:@nolyfill/side-channel@^1",
|
|
147
|
+
"string.prototype.matchall": "npm:@nolyfill/string.prototype.matchall@^1",
|
|
148
|
+
"string.prototype.repeat": "npm:@nolyfill/string.prototype.repeat@^1"
|
|
100
149
|
},
|
|
101
150
|
"engines": {
|
|
102
|
-
"node": "^20.9.0 || >=
|
|
151
|
+
"node": "^20.9.0 || >=22.0.0"
|
|
103
152
|
},
|
|
104
153
|
"scripts": {
|
|
105
|
-
"check:
|
|
106
|
-
"
|
|
154
|
+
"//check:knip": "knip",
|
|
155
|
+
"build": "npm run build:dist && npm run build:test",
|
|
156
|
+
"build:dist": "rollup -c .config/rollup.dist.config.mjs",
|
|
157
|
+
"build:test": "rollup -c .config/rollup.test.config.mjs",
|
|
107
158
|
"check:lint": "eslint --report-unused-disable-directives .",
|
|
108
159
|
"check:tsc": "tsc",
|
|
109
160
|
"check:type-coverage": "type-coverage --detail --strict --at-least 95 --ignore-files 'test/*'",
|
|
110
161
|
"check": "run-p -c --aggregate-output check:*",
|
|
111
162
|
"prepare": "husky",
|
|
112
|
-
"test:
|
|
113
|
-
"test
|
|
114
|
-
"test": "
|
|
163
|
+
"test:c8": "c8 --reporter=none node --test \"test/socket-npm.test.cjs\"",
|
|
164
|
+
"test:unit": "tap",
|
|
165
|
+
"test:coverage": "cp -r .tap/coverage/*.json coverage/tmp && c8 --reporter=lcov --reporter=text --include \"dist/*.js\" --exclude \"dist/vendor.js\" report",
|
|
166
|
+
"test-ci": "run-s build:* test:*",
|
|
167
|
+
"test": "run-s check build:* test:*",
|
|
168
|
+
"lint": "NODE_OPTIONS=--max-old-space-size=10240 eslint --quiet .",
|
|
169
|
+
"lint:fix": "npm run lint:fix:fast && NODE_OPTIONS=--max-old-space-size=10240 eslint --quiet --cache --fix .",
|
|
170
|
+
"lint:fix:fast": "prettier --cache --log-level warn --write .",
|
|
115
171
|
"//postinstall": "node ./cli.js wrapper --postinstall"
|
|
116
172
|
}
|
|
117
173
|
}
|
|
@@ -177,11 +177,11 @@
|
|
|
177
177
|
"emoji": "⚠️"
|
|
178
178
|
},
|
|
179
179
|
"extraneousDependency": {
|
|
180
|
-
"description": "Package optionally loads a dependency which is not specified within any of the package.
|
|
180
|
+
"description": "Package optionally loads a dependency which is not specified within any of the package.tson dependency fields. It may inadvertently be importing dependencies specified by other packages.",
|
|
181
181
|
"props": {
|
|
182
182
|
"name": "Name"
|
|
183
183
|
},
|
|
184
|
-
"suggestion": "Specify all optionally loaded dependencies in optionalDependencies within package.
|
|
184
|
+
"suggestion": "Specify all optionally loaded dependencies in optionalDependencies within package.tson.",
|
|
185
185
|
"title": "Extraneous dependency",
|
|
186
186
|
"emoji": "⚠️"
|
|
187
187
|
},
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
"filePath": "File path",
|
|
192
192
|
"packageName": "Package name"
|
|
193
193
|
},
|
|
194
|
-
"suggestion": "Remove the dependency specified by a file resolution string from package.
|
|
194
|
+
"suggestion": "Remove the dependency specified by a file resolution string from package.tson and update any bare name imports that referenced it before to use relative path strings.",
|
|
195
195
|
"title": "File dependency",
|
|
196
196
|
"emoji": "⚠️"
|
|
197
197
|
},
|
|
@@ -274,9 +274,9 @@
|
|
|
274
274
|
"emoji": "🤖"
|
|
275
275
|
},
|
|
276
276
|
"invalidPackageJSON": {
|
|
277
|
-
"description": "Package has an invalid package.
|
|
278
|
-
"suggestion": "Fix syntax errors in the invalid package.
|
|
279
|
-
"title": "Invalid package.
|
|
277
|
+
"description": "Package has an invalid package.tson and can cause installation problems if you try to use it.",
|
|
278
|
+
"suggestion": "Fix syntax errors in the invalid package.tson and publish a new version with a valid package.tson. Consumers can use npm overrides to force a version that does not have this problem if one exists.",
|
|
279
|
+
"title": "Invalid package.tson",
|
|
280
280
|
"emoji": "🤒"
|
|
281
281
|
},
|
|
282
282
|
"invisibleChars": {
|
|
@@ -367,17 +367,17 @@
|
|
|
367
367
|
"emoji": "🫥"
|
|
368
368
|
},
|
|
369
369
|
"missingDependency": {
|
|
370
|
-
"description": "A required dependency is not declared in package.
|
|
370
|
+
"description": "A required dependency is not declared in package.tson and may prevent the package from working.",
|
|
371
371
|
"props": {
|
|
372
372
|
"name": "Name"
|
|
373
373
|
},
|
|
374
|
-
"suggestion": "The package should define the missing dependency inside of package.
|
|
374
|
+
"suggestion": "The package should define the missing dependency inside of package.tson 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
375
|
"title": "Missing dependency",
|
|
376
376
|
"emoji": "⚠️"
|
|
377
377
|
},
|
|
378
378
|
"missingLicense": {
|
|
379
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.
|
|
380
|
+
"suggestion": "A new version of the package should be published that includes a valid SPDX license in a license file, pacakge.tson license field or mentioned in the README.",
|
|
381
381
|
"title": "Missing license",
|
|
382
382
|
"emoji": "⚠️"
|
|
383
383
|
},
|
|
@@ -386,7 +386,7 @@
|
|
|
386
386
|
"props": {
|
|
387
387
|
"licenseId": "License Id"
|
|
388
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.
|
|
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.tson license field and license details mentioned in the README.",
|
|
390
390
|
"title": "Mixed license",
|
|
391
391
|
"emoji": "⚠️"
|
|
392
392
|
},
|
|
@@ -431,14 +431,14 @@
|
|
|
431
431
|
"emoji": "⚠️"
|
|
432
432
|
},
|
|
433
433
|
"noAuthorData": {
|
|
434
|
-
"description": "Package does not specify a list of contributors or an author in package.
|
|
435
|
-
"suggestion": "Add a author field or contributors array to package.
|
|
434
|
+
"description": "Package does not specify a list of contributors or an author in package.tson.",
|
|
435
|
+
"suggestion": "Add a author field or contributors array to package.tson.",
|
|
436
436
|
"title": "No contributors or author data",
|
|
437
437
|
"emoji": "⚠️"
|
|
438
438
|
},
|
|
439
439
|
"noBugTracker": {
|
|
440
|
-
"description": "Package does not have a linked bug tracker in package.
|
|
441
|
-
"suggestion": "Add a bugs field to package.
|
|
440
|
+
"description": "Package does not have a linked bug tracker in package.tson.",
|
|
441
|
+
"suggestion": "Add a bugs field to package.tson. https://docs.npmjs.com/cli/v8/configuring-npm/package-json#bugs",
|
|
442
442
|
"title": "No bug tracker",
|
|
443
443
|
"emoji": "⚠️"
|
|
444
444
|
},
|
|
@@ -450,7 +450,7 @@
|
|
|
450
450
|
},
|
|
451
451
|
"noRepository": {
|
|
452
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.
|
|
453
|
+
"suggestion": "Add a repository field to package.tson. https://docs.npmjs.com/cli/v8/configuring-npm/package-json#repository",
|
|
454
454
|
"title": "No repository",
|
|
455
455
|
"emoji": "⚠️"
|
|
456
456
|
},
|
|
@@ -468,7 +468,7 @@
|
|
|
468
468
|
},
|
|
469
469
|
"noWebsite": {
|
|
470
470
|
"description": "Package does not have a website.",
|
|
471
|
-
"suggestion": "Add a homepage field to package.
|
|
471
|
+
"suggestion": "Add a homepage field to package.tson. https://docs.npmjs.com/cli/v8/configuring-npm/package-json#homepage",
|
|
472
472
|
"title": "No website",
|
|
473
473
|
"emoji": "⚠️"
|
|
474
474
|
},
|
|
@@ -490,7 +490,7 @@
|
|
|
490
490
|
},
|
|
491
491
|
"nonSPDXLicense": {
|
|
492
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.
|
|
493
|
+
"suggestion": "Package should adopt a standard SPDX license consistently across all license locations (LICENSE files, package.tson license fields, and READMEs).",
|
|
494
494
|
"title": "Non SPDX license",
|
|
495
495
|
"emoji": "⚠️"
|
|
496
496
|
},
|
|
@@ -515,7 +515,7 @@
|
|
|
515
515
|
"emoji": "⚠️"
|
|
516
516
|
},
|
|
517
517
|
"peerDependency": {
|
|
518
|
-
"description": "Package specifies peer dependencies in package.
|
|
518
|
+
"description": "Package specifies peer dependencies in package.tson.",
|
|
519
519
|
"props": {
|
|
520
520
|
"name": "Name"
|
|
521
521
|
},
|
|
@@ -608,7 +608,7 @@
|
|
|
608
608
|
"props": {
|
|
609
609
|
"possibleLicenseId": "Possible license id"
|
|
610
610
|
},
|
|
611
|
-
"suggestion": "Add a LICENSE file that matches the license field in package.
|
|
611
|
+
"suggestion": "Add a LICENSE file that matches the license field in package.tson. https://docs.npmjs.com/cli/v8/configuring-npm/package-json#license",
|
|
612
612
|
"title": "Unclear license",
|
|
613
613
|
"emoji": "⚠️"
|
|
614
614
|
},
|
|
@@ -638,7 +638,7 @@
|
|
|
638
638
|
},
|
|
639
639
|
"unsafeCopyright": {
|
|
640
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.
|
|
641
|
+
"suggestion": "Clarify the license type by adding a license field to package.tson and a LICENSE file.",
|
|
642
642
|
"title": "Unsafe copyright",
|
|
643
643
|
"emoji": "⚠️"
|
|
644
644
|
},
|
package/cli.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/* eslint-disable no-console */
|
|
3
|
-
|
|
4
|
-
import chalk from 'chalk'
|
|
5
|
-
import { messageWithCauses, stackWithCauses } from 'pony-cause'
|
|
6
|
-
|
|
7
|
-
import * as cliCommands from './lib/commands/index.js'
|
|
8
|
-
import { logSymbols } from './lib/utils/chalk-markdown.js'
|
|
9
|
-
import { AuthError, InputError } from './lib/utils/errors.js'
|
|
10
|
-
import { meowWithSubcommands } from './lib/utils/meow-with-subcommands.js'
|
|
11
|
-
import { initUpdateNotifier } from './lib/utils/update-notifier.js'
|
|
12
|
-
|
|
13
|
-
// TODO: Add autocompletion using https://www.npmjs.com/package/omelette
|
|
14
|
-
|
|
15
|
-
initUpdateNotifier()
|
|
16
|
-
|
|
17
|
-
try {
|
|
18
|
-
const formattedCliCommands = Object.fromEntries(Object.entries(cliCommands).map((entry) => {
|
|
19
|
-
if (entry[0] === 'rawNpm') {
|
|
20
|
-
entry[0] = 'raw-npm'
|
|
21
|
-
} else if (entry[0] === 'rawNpx') {
|
|
22
|
-
entry[0] = 'raw-npx'
|
|
23
|
-
} else if (entry[0] === 'auditlog') {
|
|
24
|
-
entry[0] = 'audit-log'
|
|
25
|
-
}
|
|
26
|
-
return entry
|
|
27
|
-
}))
|
|
28
|
-
|
|
29
|
-
await meowWithSubcommands(
|
|
30
|
-
formattedCliCommands,
|
|
31
|
-
{
|
|
32
|
-
aliases: {
|
|
33
|
-
ci: {
|
|
34
|
-
description: 'Alias for "report create --view --strict"',
|
|
35
|
-
argv: ['report', 'create', '--view', '--strict']
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
argv: process.argv.slice(2),
|
|
39
|
-
name: 'socket',
|
|
40
|
-
importMeta: import.meta
|
|
41
|
-
}
|
|
42
|
-
)
|
|
43
|
-
} catch (err) {
|
|
44
|
-
/** @type {string} */
|
|
45
|
-
let errorTitle
|
|
46
|
-
/** @type {string} */
|
|
47
|
-
let errorMessage = ''
|
|
48
|
-
/** @type {string|undefined} */
|
|
49
|
-
let errorBody
|
|
50
|
-
|
|
51
|
-
if (err instanceof AuthError) {
|
|
52
|
-
errorTitle = 'Authentication error'
|
|
53
|
-
errorMessage = err.message
|
|
54
|
-
} else if (err instanceof InputError) {
|
|
55
|
-
errorTitle = 'Invalid input'
|
|
56
|
-
errorMessage = err.message
|
|
57
|
-
errorBody = err.body
|
|
58
|
-
} else if (err instanceof Error) {
|
|
59
|
-
errorTitle = 'Unexpected error'
|
|
60
|
-
errorMessage = messageWithCauses(err)
|
|
61
|
-
errorBody = stackWithCauses(err)
|
|
62
|
-
} else {
|
|
63
|
-
errorTitle = 'Unexpected error with no details'
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
console.error(`${logSymbols.error} ${chalk.white.bgRed(errorTitle + ':')} ${errorMessage}`)
|
|
67
|
-
if (errorBody) {
|
|
68
|
-
console.error('\n' + errorBody)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
process.exit(1)
|
|
72
|
-
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import { Separator } from '@inquirer/select'
|
|
3
|
-
import chalk from 'chalk'
|
|
4
|
-
import inquirer from 'inquirer'
|
|
5
|
-
import meow from 'meow'
|
|
6
|
-
import ora from 'ora'
|
|
7
|
-
|
|
8
|
-
import { outputFlags } from '../../flags/index.js'
|
|
9
|
-
import { handleApiCall, handleUnsuccessfulApiResponse } from '../../utils/api-helpers.js'
|
|
10
|
-
import { prepareFlags } from '../../utils/flags.js'
|
|
11
|
-
import { printFlagList } from '../../utils/formatting.js'
|
|
12
|
-
import { FREE_API_KEY, getDefaultKey, setupSdk } from '../../utils/sdk.js'
|
|
13
|
-
|
|
14
|
-
/** @type {import('../../utils/meow-with-subcommands.js').CliSubcommand} */
|
|
15
|
-
export const auditlog = {
|
|
16
|
-
description: 'Look up the audit log for an organization',
|
|
17
|
-
async run (argv, importMeta, { parentName }) {
|
|
18
|
-
const name = parentName + ' audit-log'
|
|
19
|
-
|
|
20
|
-
const input = setupCommand(name, auditlog.description, argv, importMeta)
|
|
21
|
-
if (input) {
|
|
22
|
-
const spinner = ora(`Looking up audit log for ${input.orgSlug}\n`).start()
|
|
23
|
-
await fetchOrgAuditLog(input.orgSlug, input, spinner)
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const auditLogFlags = prepareFlags({
|
|
29
|
-
type: {
|
|
30
|
-
type: 'string',
|
|
31
|
-
shortFlag: 't',
|
|
32
|
-
default: '',
|
|
33
|
-
description: 'Type of log event',
|
|
34
|
-
},
|
|
35
|
-
perPage: {
|
|
36
|
-
type: 'number',
|
|
37
|
-
shortFlag: 'pp',
|
|
38
|
-
default: 30,
|
|
39
|
-
description: 'Results per page - default is 30',
|
|
40
|
-
},
|
|
41
|
-
page: {
|
|
42
|
-
type: 'number',
|
|
43
|
-
shortFlag: 'p',
|
|
44
|
-
default: 1,
|
|
45
|
-
description: 'Page number - default is 1',
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
// Internal functions
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @typedef CommandInput
|
|
53
|
-
* @property {boolean} outputJson
|
|
54
|
-
* @property {boolean} outputMarkdown
|
|
55
|
-
* @property {string} orgSlug
|
|
56
|
-
* @property {string} type
|
|
57
|
-
* @property {number} page
|
|
58
|
-
* @property {number} per_page
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @param {string} name
|
|
63
|
-
* @param {string} description
|
|
64
|
-
* @param {readonly string[]} argv
|
|
65
|
-
* @param {ImportMeta} importMeta
|
|
66
|
-
* @returns {void|CommandInput}
|
|
67
|
-
*/
|
|
68
|
-
function setupCommand (name, description, argv, importMeta) {
|
|
69
|
-
const flags = {
|
|
70
|
-
...auditLogFlags,
|
|
71
|
-
...outputFlags
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const cli = meow(`
|
|
75
|
-
Usage
|
|
76
|
-
$ ${name} <org slug>
|
|
77
|
-
|
|
78
|
-
Options
|
|
79
|
-
${printFlagList(flags, 6)}
|
|
80
|
-
|
|
81
|
-
Examples
|
|
82
|
-
$ ${name} FakeOrg
|
|
83
|
-
`, {
|
|
84
|
-
argv,
|
|
85
|
-
description,
|
|
86
|
-
importMeta,
|
|
87
|
-
flags
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
const {
|
|
91
|
-
json: outputJson,
|
|
92
|
-
markdown: outputMarkdown,
|
|
93
|
-
type,
|
|
94
|
-
page,
|
|
95
|
-
perPage
|
|
96
|
-
} = cli.flags
|
|
97
|
-
|
|
98
|
-
if (cli.input.length < 1) {
|
|
99
|
-
console.error(`${chalk.bgRed('Input error')}: Please provide an organization slug \n`)
|
|
100
|
-
cli.showHelp()
|
|
101
|
-
return
|
|
102
|
-
}
|
|
103
|
-
const [orgSlug = ''] = cli.input
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
outputJson,
|
|
107
|
-
outputMarkdown,
|
|
108
|
-
orgSlug,
|
|
109
|
-
type: type && type.charAt(0).toUpperCase() + type.slice(1),
|
|
110
|
-
page,
|
|
111
|
-
per_page: perPage
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* @typedef AuditLogData
|
|
117
|
-
* @property {import('@socketsecurity/sdk').SocketSdkReturnType<'getAuditLogEvents'>["data"]} data
|
|
118
|
-
*/
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* @param {string} orgSlug
|
|
122
|
-
* @param {CommandInput} input
|
|
123
|
-
* @param {import('ora').Ora} spinner
|
|
124
|
-
* @returns {Promise<void|AuditLogData>}
|
|
125
|
-
*/
|
|
126
|
-
async function fetchOrgAuditLog (orgSlug, input, spinner) {
|
|
127
|
-
const socketSdk = await setupSdk(getDefaultKey() || FREE_API_KEY)
|
|
128
|
-
const result = await handleApiCall(socketSdk.getAuditLogEvents(orgSlug, input), `Looking up audit log for ${orgSlug}\n`)
|
|
129
|
-
|
|
130
|
-
if (!result.success) {
|
|
131
|
-
return handleUnsuccessfulApiResponse('getAuditLogEvents', result, spinner)
|
|
132
|
-
}
|
|
133
|
-
spinner.stop()
|
|
134
|
-
|
|
135
|
-
const /** @type {({name: string} | Separator)[]} */ data = []
|
|
136
|
-
const /** @type {{[key: string]: string}} */ logDetails = {}
|
|
137
|
-
|
|
138
|
-
result.data.results.map(d => {
|
|
139
|
-
data.push({
|
|
140
|
-
name: `${d.created_at && new Date(d.created_at).toLocaleDateString('en-us', { year: 'numeric', month: 'numeric', day: 'numeric' })} - ${d.user_email} - ${d.type} - ${d.ip_address} - ${d.user_agent}`
|
|
141
|
-
}, new Separator())
|
|
142
|
-
|
|
143
|
-
logDetails[`${d.created_at && new Date(d.created_at).toLocaleDateString('en-us', { year: 'numeric', month: 'numeric', day: 'numeric' })} - ${d.user_email} - ${d.type} - ${d.ip_address} - ${d.user_agent}`] = JSON.stringify(d.payload)
|
|
144
|
-
return data
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
inquirer
|
|
148
|
-
.prompt(
|
|
149
|
-
{
|
|
150
|
-
type: 'list',
|
|
151
|
-
name: 'log',
|
|
152
|
-
message: input.type ? `\n Audit log for: ${orgSlug} with type: ${input.type} \n` : `\n Audit log for: ${orgSlug} \n`,
|
|
153
|
-
choices: data,
|
|
154
|
-
pageSize: 30
|
|
155
|
-
}
|
|
156
|
-
)
|
|
157
|
-
.then((/** @type {{log: string}} */ answers) => console.log(logDetails[answers.log]))
|
|
158
|
-
|
|
159
|
-
return {
|
|
160
|
-
data: result.data
|
|
161
|
-
}
|
|
162
|
-
}
|