socket 1.1.12 → 1.1.14
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/CHANGELOG.md +41 -30
- package/dist/cli.js +75 -63
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +107 -5
- package/dist/constants.js.map +1 -1
- package/dist/flags.js.map +1 -1
- package/dist/npm-cli.js +3 -2
- package/dist/npm-cli.js.map +1 -1
- package/dist/shadow-npm-inject.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/commands/fix/cmd-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/coana-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/git.d.mts +1 -1
- package/dist/types/commands/fix/git.d.mts.map +1 -1
- package/dist/types/commands/fix/handle-fix.d.mts +4 -1
- package/dist/types/commands/fix/handle-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/pull-request.d.mts +1 -1
- package/dist/types/commands/fix/pull-request.d.mts.map +1 -1
- package/dist/types/commands/fix/types.d.mts +3 -0
- package/dist/types/commands/fix/types.d.mts.map +1 -1
- package/dist/types/commands/login/apply-login.d.mts.map +1 -1
- package/dist/types/commands/login/attempt-login.d.mts.map +1 -1
- package/dist/types/commands/logout/apply-logout.d.mts.map +1 -1
- package/dist/types/commands/manifest/run-cdxgen.d.mts.map +1 -1
- package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts +1 -1
- package/dist/types/commands/scan/fetch-create-org-full-scan.d.mts.map +1 -1
- package/dist/types/commands/scan/perform-reachability-analysis.d.mts.map +1 -1
- package/dist/types/constants.d.mts +74 -6
- package/dist/types/constants.d.mts.map +1 -1
- package/dist/types/flags.d.mts +1 -1
- package/dist/types/flags.d.mts.map +1 -1
- package/dist/types/shadow/npm/arborist/types.d.mts +10 -10
- package/dist/types/shadow/npm/arborist/types.d.mts.map +1 -1
- package/dist/types/shadow/npm/install.d.mts +1 -1
- package/dist/types/shadow/npm/install.d.mts.map +1 -1
- package/dist/types/types.d.mts +4 -4
- package/dist/types/types.d.mts.map +1 -1
- package/dist/types/utils/alert/artifact.d.mts +1 -1
- package/dist/types/utils/alert/artifact.d.mts.map +1 -1
- package/dist/types/utils/api.d.mts +2 -2
- package/dist/types/utils/api.d.mts.map +1 -1
- package/dist/types/utils/coana.d.mts +0 -4
- package/dist/types/utils/coana.d.mts.map +1 -1
- package/dist/types/utils/config.d.mts +4 -3
- package/dist/types/utils/config.d.mts.map +1 -1
- package/dist/types/utils/determine-org-slug.d.mts.map +1 -1
- package/dist/types/utils/dlx.d.mts +33 -0
- package/dist/types/utils/dlx.d.mts.map +1 -0
- package/dist/types/utils/errors.d.mts +1 -1
- package/dist/types/utils/errors.d.mts.map +1 -1
- package/dist/types/utils/github.d.mts +3 -3
- package/dist/types/utils/github.d.mts.map +1 -1
- package/dist/types/utils/glob.d.mts.map +1 -1
- package/dist/types/utils/meow-with-subcommands.d.mts +1 -1
- package/dist/types/utils/meow-with-subcommands.d.mts.map +1 -1
- package/dist/types/utils/package-environment.d.mts.map +1 -1
- package/dist/types/utils/sdk.d.mts.map +1 -1
- package/dist/types/utils/socket-json.d.mts +27 -27
- package/dist/types/utils/socket-json.d.mts.map +1 -1
- package/dist/utils.js +283 -140
- package/dist/utils.js.map +1 -1
- package/dist/vendor.js +235 -235
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,15 +4,26 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
6
|
|
|
7
|
+
## [1.1.14](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.14) - 2025-09-17
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- Enhanced 3rd-party on-demand download and execution
|
|
11
|
+
|
|
12
|
+
## [1.1.13](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.13) - 2025-09-16
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- New `--output-file` flag for `socket fix` to save computed fixes to a JSON file
|
|
16
|
+
- New `--only-compute` flag for `socket fix` to compute fixes without applying them
|
|
17
|
+
|
|
7
18
|
## [1.1.12](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.12) - 2025-09-15
|
|
8
19
|
|
|
9
20
|
### Fixed
|
|
10
|
-
-
|
|
21
|
+
- Enhanced security alert processing for more reliable operations
|
|
11
22
|
|
|
12
23
|
## [1.1.11](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.11) - 2025-09-12
|
|
13
24
|
|
|
14
25
|
### Fixed
|
|
15
|
-
-
|
|
26
|
+
- Improved multipart upload reliability with Socket SDK update
|
|
16
27
|
|
|
17
28
|
## [1.1.10](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.10) - 2025-09-11
|
|
18
29
|
|
|
@@ -30,7 +41,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
30
41
|
## [1.1.8](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.8) - 2025-09-11
|
|
31
42
|
|
|
32
43
|
### Changed
|
|
33
|
-
-
|
|
44
|
+
- Clearer permission error messages to help resolve access issues
|
|
34
45
|
|
|
35
46
|
## [1.1.7](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.7) - 2025-09-11
|
|
36
47
|
|
|
@@ -38,18 +49,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
38
49
|
- Control spinner display with new `--no-spinner` flag
|
|
39
50
|
|
|
40
51
|
### Fixed
|
|
41
|
-
-
|
|
52
|
+
- Enhanced proxy support for flexible network configurations
|
|
42
53
|
|
|
43
54
|
## [1.1.6](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.6) - 2025-09-10
|
|
44
55
|
|
|
45
56
|
### Fixed
|
|
46
|
-
-
|
|
57
|
+
- Improved pull request operations with better cache management
|
|
47
58
|
|
|
48
59
|
## [1.1.5](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.5) - 2025-09-10
|
|
49
60
|
|
|
50
61
|
### Fixed
|
|
51
|
-
-
|
|
52
|
-
-
|
|
62
|
+
- Enhanced reachability analysis spinner for consistent feedback
|
|
63
|
+
- Better working directory control with `--cwd` flag improvements
|
|
53
64
|
|
|
54
65
|
## [1.1.4](https://github.com/SocketDev/socket-cli/releases/tag/v1.1.4) - 2025-09-09
|
|
55
66
|
|
|
@@ -91,7 +102,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
91
102
|
- Reimplemented `--range-style` flag for `socket fix`
|
|
92
103
|
|
|
93
104
|
### Fixed
|
|
94
|
-
-
|
|
105
|
+
- Enhanced CI/CD compatibility for reachability analysis and fixes
|
|
95
106
|
|
|
96
107
|
## [1.0.110](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.110) - 2025-09-03
|
|
97
108
|
|
|
@@ -101,112 +112,112 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
101
112
|
## [1.0.109](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.109) - 2025-09-03
|
|
102
113
|
|
|
103
114
|
### Changed
|
|
104
|
-
-
|
|
115
|
+
- Improved build environment handling for better compatibility
|
|
105
116
|
|
|
106
117
|
## [1.0.108](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.108) - 2025-09-03
|
|
107
118
|
|
|
108
119
|
### Changed
|
|
109
|
-
-
|
|
120
|
+
- Cleaner output from wrapped commands for focused results
|
|
110
121
|
|
|
111
122
|
## [1.0.107](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.107) - 2025-09-02
|
|
112
123
|
|
|
113
124
|
### Fixed
|
|
114
|
-
-
|
|
125
|
+
- Restored build stability for reliable deployments
|
|
115
126
|
|
|
116
127
|
## [1.0.106](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.106) - 2025-09-02
|
|
117
128
|
|
|
118
129
|
### Added
|
|
119
|
-
-
|
|
130
|
+
- Control reachability analysis caching with new `--reach-skip-cache` flag
|
|
120
131
|
|
|
121
132
|
## [1.0.104](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.104) - 2025-08-29
|
|
122
133
|
|
|
123
134
|
### Fixed
|
|
124
|
-
-
|
|
135
|
+
- Enhanced security advisory resolution for accurate vulnerability tracking
|
|
125
136
|
|
|
126
137
|
## [1.0.103](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.103) - 2025-08-29
|
|
127
138
|
|
|
128
139
|
### Fixed
|
|
129
|
-
-
|
|
140
|
+
- Improved GitHub Security Advisory processing
|
|
130
141
|
|
|
131
142
|
## [1.0.102](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.102) - 2025-08-29
|
|
132
143
|
|
|
133
144
|
### Fixed
|
|
134
|
-
-
|
|
145
|
+
- Enhanced command flag processing for better reliability
|
|
135
146
|
|
|
136
147
|
## [1.0.100](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.100) - 2025-08-29
|
|
137
148
|
|
|
138
149
|
### Added
|
|
139
|
-
-
|
|
150
|
+
- Richer debugging output for security advisory analysis
|
|
140
151
|
|
|
141
152
|
## [1.0.96](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.96) - 2025-08-27
|
|
142
153
|
|
|
143
154
|
### Changed
|
|
144
|
-
-
|
|
155
|
+
- Streamlined organization selection for reachability analysis
|
|
145
156
|
|
|
146
157
|
## [1.0.89](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.89) - 2025-08-15
|
|
147
158
|
|
|
148
159
|
### Added
|
|
149
|
-
-
|
|
160
|
+
- Comprehensive manifest scanning with `socket scan create --reach`
|
|
150
161
|
|
|
151
162
|
## [1.0.85](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.85) - 2025-08-01
|
|
152
163
|
|
|
153
164
|
### Added
|
|
154
|
-
-
|
|
165
|
+
- Flexible npm path configuration via `SOCKET_CLI_NPM_PATH` environment variable
|
|
155
166
|
|
|
156
167
|
## [1.0.82](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.82) - 2025-07-30
|
|
157
168
|
|
|
158
169
|
### Added
|
|
159
|
-
-
|
|
170
|
+
- Memory optimization controls with `--max-old-space-size` and `--max-semi-space-size` flags
|
|
160
171
|
|
|
161
172
|
## [1.0.80](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.80) - 2025-07-29
|
|
162
173
|
|
|
163
174
|
### Changed
|
|
164
|
-
-
|
|
175
|
+
- Enhanced file discovery feedback in `socket scan create`
|
|
165
176
|
|
|
166
177
|
## [1.0.73](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.73) - 2025-07-14
|
|
167
178
|
|
|
168
179
|
### Added
|
|
169
|
-
-
|
|
180
|
+
- Automatic detection of `.socket.facts.json` configuration files
|
|
170
181
|
|
|
171
182
|
## [1.0.69](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.69) - 2025-07-10
|
|
172
183
|
|
|
173
184
|
### Added
|
|
174
|
-
-
|
|
185
|
+
- Skip pull request checks with new `--no-pr-check` flag for `socket fix`
|
|
175
186
|
|
|
176
187
|
## [1.0.10](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.10) - 2025-06-28
|
|
177
188
|
|
|
178
189
|
### Changed
|
|
179
|
-
-
|
|
190
|
+
- Enhanced performance and reliability across all commands
|
|
180
191
|
|
|
181
192
|
## [1.0.9](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.9) - 2025-06-28
|
|
182
193
|
|
|
183
194
|
### Changed
|
|
184
|
-
-
|
|
195
|
+
- Improved stability and command execution speed
|
|
185
196
|
|
|
186
197
|
## [1.0.8](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.8) - 2025-06-27
|
|
187
198
|
|
|
188
199
|
### Changed
|
|
189
|
-
-
|
|
200
|
+
- Faster command processing with optimized internals
|
|
190
201
|
|
|
191
202
|
## [1.0.7](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.7) - 2025-06-25
|
|
192
203
|
|
|
193
204
|
### Changed
|
|
194
|
-
-
|
|
205
|
+
- Enhanced reliability through improved code quality
|
|
195
206
|
|
|
196
207
|
## [1.0.6](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.6) - 2025-06-25
|
|
197
208
|
|
|
198
209
|
### Changed
|
|
199
|
-
-
|
|
210
|
+
- Smoother user experience with targeted improvements
|
|
200
211
|
|
|
201
212
|
## [1.0.5](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.5) - 2025-06-25
|
|
202
213
|
|
|
203
214
|
### Changed
|
|
204
|
-
-
|
|
215
|
+
- Faster command execution with performance enhancements
|
|
205
216
|
|
|
206
217
|
## [1.0.4](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.4) - 2025-06-25
|
|
207
218
|
|
|
208
219
|
### Changed
|
|
209
|
-
-
|
|
220
|
+
- More stable operations with targeted fixes
|
|
210
221
|
|
|
211
222
|
## [1.0.3](https://github.com/SocketDev/socket-cli/releases/tag/v1.0.3) - 2025-06-25
|
|
212
223
|
|
package/dist/cli.js
CHANGED
|
@@ -19,7 +19,6 @@ var spawn = require('../external/@socketsecurity/registry/lib/spawn');
|
|
|
19
19
|
var fs$2 = require('../external/@socketsecurity/registry/lib/fs');
|
|
20
20
|
var strings = require('../external/@socketsecurity/registry/lib/strings');
|
|
21
21
|
var path$1 = require('../external/@socketsecurity/registry/lib/path');
|
|
22
|
-
var shadowNpmBin = require('./shadow-npm-bin.js');
|
|
23
22
|
var require$$11 = require('../external/@socketsecurity/registry/lib/objects');
|
|
24
23
|
var registry = require('../external/@socketsecurity/registry');
|
|
25
24
|
var packages = require('../external/@socketsecurity/registry/lib/packages');
|
|
@@ -68,7 +67,7 @@ async function fetchRepoAnalyticsData(repo, time, options) {
|
|
|
68
67
|
|
|
69
68
|
// Note: Widgets does not seem to actually work as code :'(
|
|
70
69
|
|
|
71
|
-
const require$
|
|
70
|
+
const require$7 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
|
|
72
71
|
const METRICS = ['total_critical_alerts', 'total_high_alerts', 'total_medium_alerts', 'total_low_alerts', 'total_critical_added', 'total_medium_added', 'total_low_added', 'total_high_added', 'total_critical_prevented', 'total_high_prevented', 'total_medium_prevented', 'total_low_prevented'];
|
|
73
72
|
|
|
74
73
|
// Note: This maps `new Date(date).getMonth()` to English three letters
|
|
@@ -147,11 +146,11 @@ ${utils.mdTableStringNumber('Name', 'Counts', data['top_five_alert_types'])}
|
|
|
147
146
|
`.trim() + '\n';
|
|
148
147
|
}
|
|
149
148
|
function displayAnalyticsScreen(data) {
|
|
150
|
-
const ScreenWidget = /*@__PURE__*/require$
|
|
149
|
+
const ScreenWidget = /*@__PURE__*/require$7('../external/blessed/lib/widgets/screen.js');
|
|
151
150
|
const screen = new ScreenWidget({
|
|
152
151
|
...constants.default.blessedOptions
|
|
153
152
|
});
|
|
154
|
-
const GridLayout = /*@__PURE__*/require$
|
|
153
|
+
const GridLayout = /*@__PURE__*/require$7('../external/blessed-contrib/lib/layout/grid.js');
|
|
155
154
|
const grid = new GridLayout({
|
|
156
155
|
rows: 5,
|
|
157
156
|
cols: 4,
|
|
@@ -165,7 +164,7 @@ function displayAnalyticsScreen(data) {
|
|
|
165
164
|
renderLineCharts(grid, screen, 'Total high alerts prevented from the main branch', [2, 2, 1, 2], data['total_high_prevented']);
|
|
166
165
|
renderLineCharts(grid, screen, 'Total medium alerts prevented from the main branch', [3, 0, 1, 2], data['total_medium_prevented']);
|
|
167
166
|
renderLineCharts(grid, screen, 'Total low alerts prevented from the main branch', [3, 2, 1, 2], data['total_low_prevented']);
|
|
168
|
-
const BarChart = /*@__PURE__*/require$
|
|
167
|
+
const BarChart = /*@__PURE__*/require$7('../external/blessed-contrib/lib/widget/charts/bar.js');
|
|
169
168
|
const bar = grid.set(4, 0, 1, 2, BarChart, {
|
|
170
169
|
label: 'Top 5 alert types',
|
|
171
170
|
barWidth: 10,
|
|
@@ -265,7 +264,7 @@ function formatDate(date) {
|
|
|
265
264
|
return `${Months[new Date(date).getMonth()]} ${new Date(date).getDate()}`;
|
|
266
265
|
}
|
|
267
266
|
function renderLineCharts(grid, screen, title, coords, data) {
|
|
268
|
-
const LineChart = /*@__PURE__*/require$
|
|
267
|
+
const LineChart = /*@__PURE__*/require$7('../external/blessed-contrib/lib/widget/charts/line.js');
|
|
269
268
|
const line = grid.set(...coords, LineChart, {
|
|
270
269
|
style: {
|
|
271
270
|
line: 'cyan',
|
|
@@ -500,7 +499,7 @@ async function fetchAuditLog(config, options) {
|
|
|
500
499
|
});
|
|
501
500
|
}
|
|
502
501
|
|
|
503
|
-
const require$
|
|
502
|
+
const require$6 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
|
|
504
503
|
async function outputAuditLog(result, {
|
|
505
504
|
logType,
|
|
506
505
|
orgSlug,
|
|
@@ -628,7 +627,7 @@ async function outputWithBlessed(data, orgSlug) {
|
|
|
628
627
|
const headers = [' Event id', ' Created at', ' Event type', ' User email', ' IP address', ' User agent'];
|
|
629
628
|
|
|
630
629
|
// Note: this temporarily takes over the terminal (just like `man` does).
|
|
631
|
-
const ScreenWidget = /*@__PURE__*/require$
|
|
630
|
+
const ScreenWidget = /*@__PURE__*/require$6('../external/blessed/lib/widgets/screen.js');
|
|
632
631
|
const screen = new ScreenWidget({
|
|
633
632
|
...constants.default.blessedOptions
|
|
634
633
|
});
|
|
@@ -637,7 +636,7 @@ async function outputWithBlessed(data, orgSlug) {
|
|
|
637
636
|
// node process just to exit it. That's very bad UX.
|
|
638
637
|
// eslint-disable-next-line n/no-process-exit
|
|
639
638
|
screen.key(['escape', 'q', 'C-c'], () => process.exit(0));
|
|
640
|
-
const TableWidget = /*@__PURE__*/require$
|
|
639
|
+
const TableWidget = /*@__PURE__*/require$6('../external/blessed-contrib/lib/widget/table.js');
|
|
641
640
|
const tipsBoxHeight = 1; // 1 row for tips box
|
|
642
641
|
const detailsBoxHeight = 20; // bottom N rows for details box. 20 gives 4 lines for condensed payload before it scrolls out of view
|
|
643
642
|
|
|
@@ -667,7 +666,7 @@ async function outputWithBlessed(data, orgSlug) {
|
|
|
667
666
|
columnSpacing: 4,
|
|
668
667
|
truncate: '_'
|
|
669
668
|
});
|
|
670
|
-
const BoxWidget = /*@__PURE__*/require$
|
|
669
|
+
const BoxWidget = /*@__PURE__*/require$6('../external/blessed/lib/widgets/box.js');
|
|
671
670
|
const tipsBox = new BoxWidget({
|
|
672
671
|
bottom: detailsBoxHeight,
|
|
673
672
|
// sits just above the details box
|
|
@@ -1636,7 +1635,7 @@ async function performReachabilityAnalysis(options) {
|
|
|
1636
1635
|
}
|
|
1637
1636
|
|
|
1638
1637
|
// Run Coana with the manifests tar hash.
|
|
1639
|
-
const coanaResult = await utils.
|
|
1638
|
+
const coanaResult = await utils.spawnCoanaDlx(coanaArgs, orgSlug, {
|
|
1640
1639
|
cwd,
|
|
1641
1640
|
env: coanaEnv,
|
|
1642
1641
|
spinner,
|
|
@@ -3441,8 +3440,11 @@ async function coanaFix(fixConfig) {
|
|
|
3441
3440
|
autopilot,
|
|
3442
3441
|
cwd,
|
|
3443
3442
|
ghsas,
|
|
3443
|
+
glob,
|
|
3444
3444
|
limit,
|
|
3445
|
+
onlyCompute,
|
|
3445
3446
|
orgSlug,
|
|
3447
|
+
outputFile,
|
|
3446
3448
|
spinner
|
|
3447
3449
|
} = fixConfig;
|
|
3448
3450
|
const fixEnv = await getFixEnv();
|
|
@@ -3494,7 +3496,7 @@ async function coanaFix(fixConfig) {
|
|
|
3494
3496
|
}
|
|
3495
3497
|
};
|
|
3496
3498
|
}
|
|
3497
|
-
const fixCResult = await utils.
|
|
3499
|
+
const fixCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ...(isAll ? ['all'] : ghsas), ...(fixConfig.rangeStyle ? ['--range-style', fixConfig.rangeStyle] : []), ...(glob ? ['--glob', glob] : []), ...(onlyCompute ? ['--dry-run'] : []), ...(outputFile ? ['--output-file', outputFile] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
|
|
3498
3500
|
cwd,
|
|
3499
3501
|
spinner,
|
|
3500
3502
|
stdio: 'inherit'
|
|
@@ -3531,7 +3533,7 @@ async function coanaFix(fixConfig) {
|
|
|
3531
3533
|
const shouldSpawnCoana = adjustedLimit > 0;
|
|
3532
3534
|
let ids;
|
|
3533
3535
|
if (shouldSpawnCoana && isAll) {
|
|
3534
|
-
const foundCResult = await utils.
|
|
3536
|
+
const foundCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, ...(fixConfig.rangeStyle ? ['--range-style', fixConfig.rangeStyle] : []), ...(glob ? ['--glob', glob] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
|
|
3535
3537
|
cwd,
|
|
3536
3538
|
spinner
|
|
3537
3539
|
});
|
|
@@ -3573,7 +3575,7 @@ async function coanaFix(fixConfig) {
|
|
|
3573
3575
|
|
|
3574
3576
|
// Apply fix for single GHSA ID.
|
|
3575
3577
|
// eslint-disable-next-line no-await-in-loop
|
|
3576
|
-
const fixCResult = await utils.
|
|
3578
|
+
const fixCResult = await utils.spawnCoanaDlx(['compute-fixes-and-upgrade-purls', cwd, '--manifests-tar-hash', tarHash, '--apply-fixes-to', ghsaId, ...(fixConfig.rangeStyle ? ['--range-style', fixConfig.rangeStyle] : []), ...(glob ? ['--glob', glob] : []), ...fixConfig.unknownFlags], fixConfig.orgSlug, {
|
|
3577
3579
|
cwd,
|
|
3578
3580
|
spinner,
|
|
3579
3581
|
stdio: 'inherit'
|
|
@@ -3767,9 +3769,12 @@ async function handleFix({
|
|
|
3767
3769
|
autopilot,
|
|
3768
3770
|
cwd,
|
|
3769
3771
|
ghsas,
|
|
3772
|
+
glob,
|
|
3770
3773
|
limit,
|
|
3771
3774
|
minSatisfying,
|
|
3775
|
+
onlyCompute,
|
|
3772
3776
|
orgSlug,
|
|
3777
|
+
outputFile,
|
|
3773
3778
|
outputKind,
|
|
3774
3779
|
prCheck,
|
|
3775
3780
|
rangeStyle,
|
|
@@ -3781,11 +3786,14 @@ async function handleFix({
|
|
|
3781
3786
|
cwd,
|
|
3782
3787
|
// Convert mixed CVE/GHSA/PURL inputs to GHSA IDs only
|
|
3783
3788
|
ghsas: await convertIdsToGhsas(ghsas),
|
|
3789
|
+
glob,
|
|
3784
3790
|
limit,
|
|
3785
3791
|
orgSlug,
|
|
3786
3792
|
rangeStyle,
|
|
3787
3793
|
spinner,
|
|
3788
|
-
unknownFlags
|
|
3794
|
+
unknownFlags,
|
|
3795
|
+
onlyCompute,
|
|
3796
|
+
outputFile
|
|
3789
3797
|
}), outputKind);
|
|
3790
3798
|
}
|
|
3791
3799
|
|
|
@@ -3828,6 +3836,16 @@ Available styles:
|
|
|
3828
3836
|
* pin - Use the exact version (e.g. 1.2.3)
|
|
3829
3837
|
* preserve - Retain the existing version range style as-is
|
|
3830
3838
|
`.trim()
|
|
3839
|
+
},
|
|
3840
|
+
onlyCompute: {
|
|
3841
|
+
type: 'boolean',
|
|
3842
|
+
default: false,
|
|
3843
|
+
description: 'Compute fixes only, do not apply them. Logs what upgrades would be applied. If combined with --output-file, the output file will contain the upgrades that would be applied.'
|
|
3844
|
+
},
|
|
3845
|
+
outputFile: {
|
|
3846
|
+
type: 'string',
|
|
3847
|
+
default: '',
|
|
3848
|
+
description: 'Path to store upgrades as a JSON file at this path.'
|
|
3831
3849
|
}
|
|
3832
3850
|
};
|
|
3833
3851
|
const hiddenFlags = {
|
|
@@ -3839,6 +3857,12 @@ const hiddenFlags = {
|
|
|
3839
3857
|
...generalFlags$2['id'],
|
|
3840
3858
|
hidden: true
|
|
3841
3859
|
},
|
|
3860
|
+
glob: {
|
|
3861
|
+
type: 'string',
|
|
3862
|
+
default: '',
|
|
3863
|
+
description: 'Glob pattern to pass to coana for filtering files',
|
|
3864
|
+
hidden: true
|
|
3865
|
+
},
|
|
3842
3866
|
maxSatisfying: {
|
|
3843
3867
|
type: 'boolean',
|
|
3844
3868
|
default: true,
|
|
@@ -3903,7 +3927,7 @@ async function run$K(argv, importMeta, {
|
|
|
3903
3927
|
|
|
3904
3928
|
Examples
|
|
3905
3929
|
$ ${command}
|
|
3906
|
-
$ ${command} ./
|
|
3930
|
+
$ ${command} ./path/to/project --range-style pin
|
|
3907
3931
|
`
|
|
3908
3932
|
};
|
|
3909
3933
|
const cli = utils.meowOrExit({
|
|
@@ -3915,10 +3939,13 @@ async function run$K(argv, importMeta, {
|
|
|
3915
3939
|
});
|
|
3916
3940
|
const {
|
|
3917
3941
|
autopilot,
|
|
3942
|
+
glob,
|
|
3918
3943
|
json,
|
|
3919
3944
|
limit,
|
|
3920
3945
|
markdown,
|
|
3921
3946
|
maxSatisfying,
|
|
3947
|
+
onlyCompute,
|
|
3948
|
+
outputFile,
|
|
3922
3949
|
prCheck,
|
|
3923
3950
|
rangeStyle,
|
|
3924
3951
|
// We patched in this feature with `npx custompatch meow` at
|
|
@@ -3948,7 +3975,7 @@ async function run$K(argv, importMeta, {
|
|
|
3948
3975
|
const orgSlugCResult = await utils.getDefaultOrgSlug();
|
|
3949
3976
|
if (!orgSlugCResult.ok) {
|
|
3950
3977
|
process.exitCode = orgSlugCResult.code ?? 1;
|
|
3951
|
-
logger.logger.fail(
|
|
3978
|
+
logger.logger.fail(`${constants.ERROR_UNABLE_RESOLVE_ORG}.\nEnsure a Socket API token is specified for the organization using the SOCKET_CLI_API_TOKEN environment variable.`);
|
|
3952
3979
|
return;
|
|
3953
3980
|
}
|
|
3954
3981
|
const orgSlug = orgSlugCResult.data;
|
|
@@ -3964,6 +3991,7 @@ async function run$K(argv, importMeta, {
|
|
|
3964
3991
|
autopilot,
|
|
3965
3992
|
cwd,
|
|
3966
3993
|
ghsas,
|
|
3994
|
+
glob,
|
|
3967
3995
|
limit,
|
|
3968
3996
|
minSatisfying,
|
|
3969
3997
|
prCheck,
|
|
@@ -3971,7 +3999,9 @@ async function run$K(argv, importMeta, {
|
|
|
3971
3999
|
outputKind,
|
|
3972
4000
|
rangeStyle,
|
|
3973
4001
|
spinner,
|
|
3974
|
-
unknownFlags
|
|
4002
|
+
unknownFlags,
|
|
4003
|
+
onlyCompute,
|
|
4004
|
+
outputFile
|
|
3975
4005
|
});
|
|
3976
4006
|
}
|
|
3977
4007
|
|
|
@@ -4230,15 +4260,15 @@ async function run$I(argv, importMeta, {
|
|
|
4230
4260
|
}
|
|
4231
4261
|
|
|
4232
4262
|
function applyLogin(apiToken, enforcedOrgs, apiBaseUrl, apiProxy) {
|
|
4233
|
-
utils.updateConfigValue(
|
|
4234
|
-
utils.updateConfigValue(
|
|
4235
|
-
utils.updateConfigValue(
|
|
4236
|
-
utils.updateConfigValue(
|
|
4263
|
+
utils.updateConfigValue(constants.CONFIG_KEY_ENFORCED_ORGS, enforcedOrgs);
|
|
4264
|
+
utils.updateConfigValue(constants.CONFIG_KEY_API_TOKEN, apiToken);
|
|
4265
|
+
utils.updateConfigValue(constants.CONFIG_KEY_API_BASE_URL, apiBaseUrl);
|
|
4266
|
+
utils.updateConfigValue(constants.CONFIG_KEY_API_PROXY, apiProxy);
|
|
4237
4267
|
}
|
|
4238
4268
|
|
|
4239
4269
|
async function attemptLogin(apiBaseUrl, apiProxy) {
|
|
4240
|
-
apiBaseUrl ??= utils.getConfigValueOrUndef(
|
|
4241
|
-
apiProxy ??= utils.getConfigValueOrUndef(
|
|
4270
|
+
apiBaseUrl ??= utils.getConfigValueOrUndef(constants.CONFIG_KEY_API_BASE_URL) ?? undefined;
|
|
4271
|
+
apiProxy ??= utils.getConfigValueOrUndef(constants.CONFIG_KEY_API_PROXY) ?? undefined;
|
|
4242
4272
|
const apiTokenInput = await prompts.password({
|
|
4243
4273
|
message: `Enter your ${vendor.terminalLinkExports('Socket.dev API token', 'https://docs.socket.dev/docs/api-keys')} (leave blank to use a limited public token)`
|
|
4244
4274
|
});
|
|
@@ -4352,8 +4382,8 @@ async function attemptLogin(apiBaseUrl, apiProxy) {
|
|
|
4352
4382
|
logger.logger.fail('Failed to install tab completion script. Try `socket install completion` later.');
|
|
4353
4383
|
}
|
|
4354
4384
|
}
|
|
4355
|
-
utils.updateConfigValue(
|
|
4356
|
-
const previousPersistedToken = utils.getConfigValueOrUndef(
|
|
4385
|
+
utils.updateConfigValue(constants.CONFIG_KEY_DEFAULT_ORG, orgSlugs[0]);
|
|
4386
|
+
const previousPersistedToken = utils.getConfigValueOrUndef(constants.CONFIG_KEY_API_TOKEN);
|
|
4357
4387
|
try {
|
|
4358
4388
|
applyLogin(apiToken, enforcedOrgs, apiBaseUrl, apiProxy);
|
|
4359
4389
|
logger.logger.success(`API credentials ${previousPersistedToken === apiToken ? 'refreshed' : previousPersistedToken ? 'updated' : 'set'}`);
|
|
@@ -4434,10 +4464,10 @@ async function run$H(argv, importMeta, {
|
|
|
4434
4464
|
}
|
|
4435
4465
|
|
|
4436
4466
|
function applyLogout() {
|
|
4437
|
-
utils.updateConfigValue(
|
|
4438
|
-
utils.updateConfigValue(
|
|
4439
|
-
utils.updateConfigValue(
|
|
4440
|
-
utils.updateConfigValue(
|
|
4467
|
+
utils.updateConfigValue(constants.CONFIG_KEY_API_TOKEN, null);
|
|
4468
|
+
utils.updateConfigValue(constants.CONFIG_KEY_API_BASE_URL, null);
|
|
4469
|
+
utils.updateConfigValue(constants.CONFIG_KEY_API_PROXY, null);
|
|
4470
|
+
utils.updateConfigValue(constants.CONFIG_KEY_ENFORCED_ORGS, null);
|
|
4441
4471
|
}
|
|
4442
4472
|
|
|
4443
4473
|
function attemptLogout() {
|
|
@@ -4492,11 +4522,9 @@ async function run$G(argv, importMeta, {
|
|
|
4492
4522
|
attemptLogout();
|
|
4493
4523
|
}
|
|
4494
4524
|
|
|
4495
|
-
const require$6 = require$$5.createRequire((typeof document === 'undefined' ? require$$0.pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
|
|
4496
4525
|
const {
|
|
4497
4526
|
PACKAGE_LOCK_JSON,
|
|
4498
4527
|
PNPM_LOCK_YAML,
|
|
4499
|
-
YARN,
|
|
4500
4528
|
YARN_LOCK
|
|
4501
4529
|
} = constants.default;
|
|
4502
4530
|
const nodejsPlatformTypes = new Set(['javascript', 'js', 'nodejs', constants.NPM, constants.PNPM, 'ts', 'tsx', 'typescript']);
|
|
@@ -4558,30 +4586,20 @@ async function runCdxgen(argvObj) {
|
|
|
4558
4586
|
const yarnLockPath = pnpmLockPath || npmLockPath ? undefined : await utils.findUp(YARN_LOCK, {
|
|
4559
4587
|
onlyFiles: true
|
|
4560
4588
|
});
|
|
4589
|
+
const agent = pnpmLockPath ? constants.PNPM : yarnLockPath && utils.isYarnBerry() ? constants.YARN : constants.NPM;
|
|
4561
4590
|
let cleanupPackageLock = false;
|
|
4562
|
-
if (argvMutable['type'] !== YARN && nodejsPlatformTypes.has(argvMutable['type']) && yarnLockPath) {
|
|
4591
|
+
if (argvMutable['type'] !== constants.YARN && nodejsPlatformTypes.has(argvMutable['type']) && yarnLockPath) {
|
|
4563
4592
|
if (npmLockPath) {
|
|
4564
4593
|
argvMutable['type'] = constants.NPM;
|
|
4565
4594
|
} else {
|
|
4566
4595
|
// Use synp to create a package-lock.json from the yarn.lock,
|
|
4567
4596
|
// based on the node_modules folder, for a more accurate SBOM.
|
|
4568
4597
|
try {
|
|
4569
|
-
const
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
const shadowPnpmBin = /*@__PURE__*/require$6(constants.default.shadowPnpmBinPath);
|
|
4575
|
-
synpPromise = (await shadowPnpmBin(args, shadowOpts)).spawnPromise;
|
|
4576
|
-
} else if (useYarnBerry) {
|
|
4577
|
-
args = ['dlx', `synp@${constants.default.ENV.INLINED_SOCKET_CLI_SYNP_VERSION}`, '--source-file', `./${YARN_LOCK}`];
|
|
4578
|
-
const shadowYarnBin = /*@__PURE__*/require$6(constants.default.shadowYarnBinPath);
|
|
4579
|
-
synpPromise = (await shadowYarnBin(args, shadowOpts)).spawnPromise;
|
|
4580
|
-
} else {
|
|
4581
|
-
args = ['exec', '--yes', `synp@${constants.default.ENV.INLINED_SOCKET_CLI_SYNP_VERSION}`, '--source-file', `./${YARN_LOCK}`];
|
|
4582
|
-
synpPromise = (await shadowNpmBin('npm', args, shadowOpts)).spawnPromise;
|
|
4583
|
-
}
|
|
4584
|
-
await synpPromise;
|
|
4598
|
+
const synpResult = await utils.spawnSynpDlx(['--source-file', `./${YARN_LOCK}`], {
|
|
4599
|
+
...shadowOpts,
|
|
4600
|
+
agent
|
|
4601
|
+
});
|
|
4602
|
+
await synpResult.spawnPromise;
|
|
4585
4603
|
argvMutable['type'] = constants.NPM;
|
|
4586
4604
|
cleanupPackageLock = true;
|
|
4587
4605
|
} catch {}
|
|
@@ -4589,16 +4607,10 @@ async function runCdxgen(argvObj) {
|
|
|
4589
4607
|
}
|
|
4590
4608
|
|
|
4591
4609
|
// Use appropriate package manager for cdxgen
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
} else if (yarnLockPath && utils.isYarnBerry()) {
|
|
4597
|
-
const shadowYarnBin = /*@__PURE__*/require$6(constants.default.shadowYarnBinPath);
|
|
4598
|
-
shadowResult = await shadowYarnBin(['dlx', '--quiet', `@cyclonedx/cdxgen@${constants.default.ENV.INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION}`, ...argvToArray(argvMutable)], shadowOpts);
|
|
4599
|
-
} else {
|
|
4600
|
-
shadowResult = await shadowNpmBin('npm', ['exec', '--silent', '--yes', `@cyclonedx/cdxgen@${constants.default.ENV.INLINED_SOCKET_CLI_CYCLONEDX_CDXGEN_VERSION}`, '--', ...argvToArray(argvMutable)], shadowOpts);
|
|
4601
|
-
}
|
|
4610
|
+
const shadowResult = await utils.spawnCdxgenDlx(argvToArray(argvMutable), {
|
|
4611
|
+
...shadowOpts,
|
|
4612
|
+
agent
|
|
4613
|
+
});
|
|
4602
4614
|
shadowResult.spawnPromise.process.on('exit', () => {
|
|
4603
4615
|
if (cleanupPackageLock) {
|
|
4604
4616
|
try {
|
|
@@ -6214,7 +6226,7 @@ async function run$x(argv, importMeta, context) {
|
|
|
6214
6226
|
const argsToForward = utils.filterFlags(argv, {
|
|
6215
6227
|
...flags.commonFlags,
|
|
6216
6228
|
...flags.outputFlags
|
|
6217
|
-
}, [
|
|
6229
|
+
}, [constants.FLAG_JSON]);
|
|
6218
6230
|
const {
|
|
6219
6231
|
spawnPromise
|
|
6220
6232
|
} = await shadowBin(constants.NPM, argsToForward, {
|
|
@@ -7282,7 +7294,7 @@ async function run$u(argv, importMeta, {
|
|
|
7282
7294
|
|
|
7283
7295
|
Examples
|
|
7284
7296
|
$ ${command}
|
|
7285
|
-
$ ${command} ./
|
|
7297
|
+
$ ${command} ./path/to/project --pin
|
|
7286
7298
|
`
|
|
7287
7299
|
};
|
|
7288
7300
|
const cli = utils.meowOrExit({
|
|
@@ -9194,7 +9206,7 @@ async function run$m(argv, importMeta, {
|
|
|
9194
9206
|
Examples
|
|
9195
9207
|
$ ${command}
|
|
9196
9208
|
$ ${command} --package lodash
|
|
9197
|
-
$ ${command} ./
|
|
9209
|
+
$ ${command} ./path/to/project --package lodash,react
|
|
9198
9210
|
`
|
|
9199
9211
|
};
|
|
9200
9212
|
const cli = utils.meowOrExit({
|
|
@@ -14640,5 +14652,5 @@ void (async () => {
|
|
|
14640
14652
|
await utils.captureException(e);
|
|
14641
14653
|
}
|
|
14642
14654
|
})();
|
|
14643
|
-
//# debugId=
|
|
14655
|
+
//# debugId=934b325d-4c21-4b37-9c71-c80f38f54d52
|
|
14644
14656
|
//# sourceMappingURL=cli.js.map
|