Skip to content

Commit 07ada33

Browse files
mtorpjdalton
authored andcommitted
add --reach-debug flag to enable verbose logging in the reachability (Coana) CLI
1 parent 898694a commit 07ada33

File tree

9 files changed

+73
-55
lines changed

9 files changed

+73
-55
lines changed

src/commands/analytics/output-analytics.test.mts

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -22,76 +22,76 @@ describe('output-analytics', () => {
2222
"unmaintained": 133,
2323
},
2424
"total_critical_added": {
25-
"Apr 18": 0,
2625
"Apr 19": 0,
2726
"Apr 20": 0,
2827
"Apr 21": 0,
28+
"Apr 22": 0,
2929
},
3030
"total_critical_alerts": {
31-
"Apr 18": 0,
3231
"Apr 19": 0,
3332
"Apr 20": 0,
3433
"Apr 21": 0,
34+
"Apr 22": 0,
3535
},
3636
"total_critical_prevented": {
37-
"Apr 18": 0,
3837
"Apr 19": 0,
3938
"Apr 20": 0,
4039
"Apr 21": 0,
40+
"Apr 22": 0,
4141
},
4242
"total_high_added": {
43-
"Apr 18": 0,
4443
"Apr 19": 0,
4544
"Apr 20": 0,
4645
"Apr 21": 0,
46+
"Apr 22": 0,
4747
},
4848
"total_high_alerts": {
49-
"Apr 18": 13,
5049
"Apr 19": 13,
5150
"Apr 20": 13,
52-
"Apr 21": 10,
51+
"Apr 21": 13,
52+
"Apr 22": 10,
5353
},
5454
"total_high_prevented": {
55-
"Apr 18": 0,
5655
"Apr 19": 0,
5756
"Apr 20": 0,
5857
"Apr 21": 0,
58+
"Apr 22": 0,
5959
},
6060
"total_low_added": {
61-
"Apr 18": 0,
6261
"Apr 19": 0,
6362
"Apr 20": 0,
6463
"Apr 21": 0,
64+
"Apr 22": 0,
6565
},
6666
"total_low_alerts": {
67-
"Apr 18": 1054,
68-
"Apr 19": 1060,
69-
"Apr 20": 1066,
70-
"Apr 21": 1059,
67+
"Apr 19": 1054,
68+
"Apr 20": 1060,
69+
"Apr 21": 1066,
70+
"Apr 22": 1059,
7171
},
7272
"total_low_prevented": {
73-
"Apr 18": 0,
7473
"Apr 19": 0,
7574
"Apr 20": 0,
7675
"Apr 21": 0,
76+
"Apr 22": 0,
7777
},
7878
"total_medium_added": {
79-
"Apr 18": 0,
8079
"Apr 19": 0,
8180
"Apr 20": 0,
8281
"Apr 21": 0,
82+
"Apr 22": 0,
8383
},
8484
"total_medium_alerts": {
85-
"Apr 18": 206,
86-
"Apr 19": 207,
87-
"Apr 20": 209,
88-
"Apr 21": 206,
85+
"Apr 19": 206,
86+
"Apr 20": 207,
87+
"Apr 21": 209,
88+
"Apr 22": 206,
8989
},
9090
"total_medium_prevented": {
91-
"Apr 18": 0,
9291
"Apr 19": 0,
9392
"Apr 20": 0,
9493
"Apr 21": 0,
94+
"Apr 22": 0,
9595
},
9696
}
9797
`)
@@ -110,76 +110,76 @@ describe('output-analytics', () => {
110110
"unmaintained": 532,
111111
},
112112
"total_critical_added": {
113-
"Apr 18": 0,
114113
"Apr 19": 0,
115114
"Apr 20": 0,
116115
"Apr 21": 0,
116+
"Apr 22": 0,
117117
},
118118
"total_critical_alerts": {
119-
"Apr 18": 0,
120119
"Apr 19": 0,
121120
"Apr 20": 0,
122121
"Apr 21": 0,
122+
"Apr 22": 0,
123123
},
124124
"total_critical_prevented": {
125-
"Apr 18": 0,
126125
"Apr 19": 0,
127126
"Apr 20": 0,
128127
"Apr 21": 0,
128+
"Apr 22": 0,
129129
},
130130
"total_high_added": {
131-
"Apr 18": 0,
132131
"Apr 19": 0,
133132
"Apr 20": 0,
134133
"Apr 21": 0,
134+
"Apr 22": 0,
135135
},
136136
"total_high_alerts": {
137-
"Apr 18": 13,
138137
"Apr 19": 13,
139138
"Apr 20": 13,
140-
"Apr 21": 10,
139+
"Apr 21": 13,
140+
"Apr 22": 10,
141141
},
142142
"total_high_prevented": {
143-
"Apr 18": 0,
144143
"Apr 19": 0,
145144
"Apr 20": 0,
146145
"Apr 21": 0,
146+
"Apr 22": 0,
147147
},
148148
"total_low_added": {
149-
"Apr 18": 0,
150149
"Apr 19": 0,
151150
"Apr 20": 0,
152151
"Apr 21": 0,
152+
"Apr 22": 0,
153153
},
154154
"total_low_alerts": {
155-
"Apr 18": 1054,
156-
"Apr 19": 1060,
157-
"Apr 20": 1066,
158-
"Apr 21": 1059,
155+
"Apr 19": 1054,
156+
"Apr 20": 1060,
157+
"Apr 21": 1066,
158+
"Apr 22": 1059,
159159
},
160160
"total_low_prevented": {
161-
"Apr 18": 0,
162161
"Apr 19": 0,
163162
"Apr 20": 0,
164163
"Apr 21": 0,
164+
"Apr 22": 0,
165165
},
166166
"total_medium_added": {
167-
"Apr 18": 0,
168167
"Apr 19": 0,
169168
"Apr 20": 0,
170169
"Apr 21": 0,
170+
"Apr 22": 0,
171171
},
172172
"total_medium_alerts": {
173-
"Apr 18": 206,
174-
"Apr 19": 207,
175-
"Apr 20": 209,
176-
"Apr 21": 206,
173+
"Apr 19": 206,
174+
"Apr 20": 207,
175+
"Apr 21": 209,
176+
"Apr 22": 206,
177177
},
178178
"total_medium_prevented": {
179-
"Apr 18": 0,
180179
"Apr 19": 0,
181180
"Apr 20": 0,
182181
"Apr 21": 0,
182+
"Apr 22": 0,
183183
},
184184
}
185185
`)
@@ -200,80 +200,80 @@ describe('output-analytics', () => {
200200
201201
| Date | Counts |
202202
| ------ | ------ |
203-
| Apr 18 | 0 |
204-
| Apr 20 | 0 |
205203
| Apr 19 | 0 |
206204
| Apr 21 | 0 |
205+
| Apr 20 | 0 |
206+
| Apr 22 | 0 |
207207
| ------ | ------ |
208208
209209
## Total high alerts
210210
211211
| Date | Counts |
212212
| ------ | ------ |
213-
| Apr 18 | 13 |
214-
| Apr 20 | 13 |
215213
| Apr 19 | 13 |
216-
| Apr 21 | 10 |
214+
| Apr 21 | 13 |
215+
| Apr 20 | 13 |
216+
| Apr 22 | 10 |
217217
| ------ | ------ |
218218
219219
## Total critical alerts added to the main branch
220220
221221
| Date | Counts |
222222
| ------ | ------ |
223-
| Apr 18 | 0 |
224-
| Apr 20 | 0 |
225223
| Apr 19 | 0 |
226224
| Apr 21 | 0 |
225+
| Apr 20 | 0 |
226+
| Apr 22 | 0 |
227227
| ------ | ------ |
228228
229229
## Total high alerts added to the main branch
230230
231231
| Date | Counts |
232232
| ------ | ------ |
233-
| Apr 18 | 0 |
234-
| Apr 20 | 0 |
235233
| Apr 19 | 0 |
236234
| Apr 21 | 0 |
235+
| Apr 20 | 0 |
236+
| Apr 22 | 0 |
237237
| ------ | ------ |
238238
239239
## Total critical alerts prevented from the main branch
240240
241241
| Date | Counts |
242242
| ------ | ------ |
243-
| Apr 18 | 0 |
244-
| Apr 20 | 0 |
245243
| Apr 19 | 0 |
246244
| Apr 21 | 0 |
245+
| Apr 20 | 0 |
246+
| Apr 22 | 0 |
247247
| ------ | ------ |
248248
249249
## Total high alerts prevented from the main branch
250250
251251
| Date | Counts |
252252
| ------ | ------ |
253-
| Apr 18 | 0 |
254-
| Apr 20 | 0 |
255253
| Apr 19 | 0 |
256254
| Apr 21 | 0 |
255+
| Apr 20 | 0 |
256+
| Apr 22 | 0 |
257257
| ------ | ------ |
258258
259259
## Total medium alerts prevented from the main branch
260260
261261
| Date | Counts |
262262
| ------ | ------ |
263-
| Apr 18 | 0 |
264-
| Apr 20 | 0 |
265263
| Apr 19 | 0 |
266264
| Apr 21 | 0 |
265+
| Apr 20 | 0 |
266+
| Apr 22 | 0 |
267267
| ------ | ------ |
268268
269269
## Total low alerts prevented from the main branch
270270
271271
| Date | Counts |
272272
| ------ | ------ |
273-
| Apr 18 | 0 |
274-
| Apr 20 | 0 |
275273
| Apr 19 | 0 |
276274
| Apr 21 | 0 |
275+
| Apr 20 | 0 |
276+
| Apr 22 | 0 |
277277
| ------ | ------ |
278278
279279
## Top 5 alert types

src/commands/ci/handle-ci.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export async function handleCi(autoManifest: boolean): Promise<void> {
5454
reachAnalysisTimeout: 0,
5555
reachAnalysisMemoryLimit: 0,
5656
reachConcurrency: 1,
57+
reachDebug: false,
5758
reachDisableAnalytics: false,
5859
reachDisableAnalysisSplitting: false,
5960
reachEcosystems: [],

src/commands/scan/cmd-scan-create.mts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ async function run(
239239
reachAnalysisMemoryLimit,
240240
reachAnalysisTimeout,
241241
reachConcurrency,
242+
reachDebug,
242243
reachDisableAnalysisSplitting,
243244
reachDisableAnalytics,
244245
reachSkipCache,
@@ -266,6 +267,7 @@ async function run(
266267
reachAnalysisTimeout: number
267268
reachAnalysisMemoryLimit: number
268269
reachConcurrency: number
270+
reachDebug: boolean
269271
reachDisableAnalytics: boolean
270272
reachDisableAnalysisSplitting: boolean
271273
reachSkipCache: boolean
@@ -523,6 +525,7 @@ async function run(
523525
reachAnalysisTimeout: Number(reachAnalysisTimeout),
524526
reachAnalysisMemoryLimit: Number(reachAnalysisMemoryLimit),
525527
reachConcurrency: Number(reachConcurrency),
528+
reachDebug: Boolean(reachDebug),
526529
reachDisableAnalysisSplitting: Boolean(reachDisableAnalysisSplitting),
527530
reachEcosystems,
528531
reachExcludePaths,

src/commands/scan/cmd-scan-create.test.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ describe('socket scan create', async () => {
5757
--reach-analysis-memory-limit The maximum memory in MB to use for the reachability analysis. The default is 8192MB.
5858
--reach-analysis-timeout Set timeout for the reachability analysis. Split analysis runs may cause the total scan time to exceed this timeout significantly.
5959
--reach-concurrency Set the maximum number of concurrent reachability analysis runs. It is recommended to choose a concurrency level that ensures each analysis run has at least the --reach-analysis-memory-limit amount of memory available. NPM reachability analysis does not support concurrent execution, so the concurrency level is ignored for NPM.
60+
--reach-debug Enable debug mode for reachability analysis. Provides verbose logging from the reachability CLI.
6061
--reach-disable-analysis-splitting Limits Coana to at most 1 reachability analysis run per workspace.
6162
--reach-disable-analytics Disable reachability analytics sharing with Socket. Also disables caching-based optimizations.
6263
--reach-ecosystems List of ecosystems to conduct reachability analysis on, as either a comma separated value or as multiple flags. Defaults to all ecosystems.

src/commands/scan/cmd-scan-reach.mts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ async function run(
112112
reachAnalysisMemoryLimit,
113113
reachAnalysisTimeout,
114114
reachConcurrency,
115+
reachDebug,
115116
reachDisableAnalysisSplitting,
116117
reachDisableAnalytics,
117118
reachSkipCache,
@@ -124,6 +125,7 @@ async function run(
124125
reachAnalysisTimeout: number
125126
reachAnalysisMemoryLimit: number
126127
reachConcurrency: number
128+
reachDebug: boolean
127129
reachDisableAnalytics: boolean
128130
reachDisableAnalysisSplitting: boolean
129131
reachSkipCache: boolean
@@ -207,6 +209,7 @@ async function run(
207209
reachAnalysisTimeout: Number(reachAnalysisTimeout),
208210
reachAnalysisMemoryLimit: Number(reachAnalysisMemoryLimit),
209211
reachConcurrency: Number(reachConcurrency),
212+
reachDebug: Boolean(reachDebug),
210213
reachDisableAnalytics: Boolean(reachDisableAnalytics),
211214
reachDisableAnalysisSplitting: Boolean(reachDisableAnalysisSplitting),
212215
reachEcosystems,

src/commands/scan/cmd-scan-reach.test.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ describe('socket scan reach', async () => {
3939
--reach-analysis-memory-limit The maximum memory in MB to use for the reachability analysis. The default is 8192MB.
4040
--reach-analysis-timeout Set timeout for the reachability analysis. Split analysis runs may cause the total scan time to exceed this timeout significantly.
4141
--reach-concurrency Set the maximum number of concurrent reachability analysis runs. It is recommended to choose a concurrency level that ensures each analysis run has at least the --reach-analysis-memory-limit amount of memory available. NPM reachability analysis does not support concurrent execution, so the concurrency level is ignored for NPM.
42+
--reach-debug Enable debug mode for reachability analysis. Provides verbose logging from the reachability CLI.
4243
--reach-disable-analysis-splitting Limits Coana to at most 1 reachability analysis run per workspace.
4344
--reach-disable-analytics Disable reachability analytics sharing with Socket. Also disables caching-based optimizations.
4445
--reach-ecosystems List of ecosystems to conduct reachability analysis on, as either a comma separated value or as multiple flags. Defaults to all ecosystems.

src/commands/scan/create-scan-from-github.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ async function scanOneRepo(
254254
reachAnalysisTimeout: 0,
255255
reachAnalysisMemoryLimit: 0,
256256
reachConcurrency: 1,
257+
reachDebug: false,
257258
reachDisableAnalysisSplitting: false,
258259
reachEcosystems: [],
259260
reachExcludePaths: [],

src/commands/scan/perform-reachability-analysis.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type ReachabilityOptions = {
1717
reachAnalysisTimeout: number
1818
reachAnalysisMemoryLimit: number
1919
reachConcurrency: number
20+
reachDebug: boolean
2021
reachDisableAnalytics: boolean
2122
reachDisableAnalysisSplitting: boolean
2223
reachEcosystems: PURL_Type[]
@@ -151,6 +152,7 @@ export async function performReachabilityAnalysis(
151152
...(reachabilityOptions.reachConcurrency
152153
? ['--concurrency', `${reachabilityOptions.reachConcurrency}`]
153154
: []),
155+
...(reachabilityOptions.reachDebug ? ['--debug'] : []),
154156
...(reachabilityOptions.reachDisableAnalytics
155157
? ['--disable-analytics-sharing']
156158
: []),

src/commands/scan/reachability-flags.mts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ export const reachabilityFlags: MeowFlags = {
1919
description:
2020
'Set the maximum number of concurrent reachability analysis runs. It is recommended to choose a concurrency level that ensures each analysis run has at least the --reach-analysis-memory-limit amount of memory available. NPM reachability analysis does not support concurrent execution, so the concurrency level is ignored for NPM.',
2121
},
22+
reachDebug: {
23+
type: 'boolean',
24+
default: false,
25+
description:
26+
'Enable debug mode for reachability analysis. Provides verbose logging from the reachability CLI.',
27+
},
2228
reachDisableAnalytics: {
2329
type: 'boolean',
2430
default: false,

0 commit comments

Comments
 (0)