Skip to content

Commit 4c2446d

Browse files
authored
Add --reach-skip-cache to disable reachability analysis configuration caching and pass --range-style to the Coana fix CLI (#724)
* add --reach-skip-cache option for disabling the reachability analysis configuration caching that is otherwise enabled by default * pass the --range-style to the Coana CLI for fixes * upgrade Coana CLI to 14.12.12
1 parent 25f35f5 commit 4c2446d

11 files changed

+31
-6
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"@babel/preset-typescript": "7.27.1",
8686
"@babel/runtime": "7.28.3",
8787
"@biomejs/biome": "2.2.2",
88-
"@coana-tech/cli": "14.12.10",
88+
"@coana-tech/cli": "14.12.12",
8989
"@cyclonedx/cdxgen": "11.6.0",
9090
"@dotenvx/dotenvx": "1.49.0",
9191
"@eslint/compat": "1.3.2",

src/commands/ci/handle-ci.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export async function handleCi(autoManifest: boolean): Promise<void> {
4343
reachDisableAnalytics: false,
4444
reachEcosystems: [],
4545
reachExcludePaths: [],
46+
reachSkipCache: false,
4647
runReachabilityAnalysis: false,
4748
},
4849
repoName,

src/commands/fix/coana-fix.mts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ export async function coanaFix(
9898
tarHash,
9999
'--apply-fixes-to',
100100
...(isAll ? ['all'] : ghsas),
101+
...(fixConfig.rangeStyle
102+
? ['--range-style', fixConfig.rangeStyle]
103+
: []),
101104
...fixConfig.unknownFlags,
102105
],
103106
fixConfig.orgSlug,
@@ -115,6 +118,9 @@ export async function coanaFix(
115118
cwd,
116119
'--manifests-tar-hash',
117120
tarHash,
121+
...(fixConfig.rangeStyle
122+
? ['--range-style', fixConfig.rangeStyle]
123+
: []),
118124
...fixConfig.unknownFlags,
119125
],
120126
fixConfig.orgSlug,

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ async function run(
227227
reachAnalysisMemoryLimit,
228228
reachAnalysisTimeout,
229229
reachDisableAnalytics,
230+
reachSkipCache,
230231
readOnly,
231232
setAsAlertsPage: pendingHeadFlag,
232233
tmp,
@@ -249,6 +250,7 @@ async function run(
249250
reachAnalysisTimeout: number
250251
reachAnalysisMemoryLimit: number
251252
reachDisableAnalytics: boolean
253+
reachSkipCache: boolean
252254
}
253255

254256
const dryRun = !!cli.flags['dryRun']
@@ -424,7 +426,8 @@ async function run(
424426
isUsingNonDefaultTimeout ||
425427
isUsingNonDefaultAnalytics ||
426428
hasReachEcosystems ||
427-
hasReachExcludePaths
429+
hasReachExcludePaths ||
430+
reachSkipCache
428431

429432
const wasValidInput = checkCommandInput(
430433
outputKind,
@@ -499,6 +502,7 @@ async function run(
499502
reachAnalysisMemoryLimit: Number(reachAnalysisMemoryLimit),
500503
reachEcosystems,
501504
reachExcludePaths,
505+
reachSkipCache: Boolean(reachSkipCache),
502506
},
503507
readOnly: Boolean(readOnly),
504508
repoName,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ describe('socket scan create', async () => {
4848
--reach-disable-analytics Disable reachability analytics sharing with Socket. Also disables caching-based optimizations.
4949
--reach-ecosystems List of ecosystems to conduct reachability analysis on, as either a comma separated value or as multiple flags. Defaults to all ecosystems.
5050
--reach-exclude-paths List of paths to exclude from reachability analysis, as either a comma separated value or as multiple flags.
51+
--reach-skip-cache Skip caching-based optimizations. By default, the reachability analysis will use cached configurations from previous runs to speed up the analysis.
5152
5253
Uploads the specified dependency manifest files for Go, Gradle, JavaScript,
5354
Kotlin, Python, and Scala. Files like "package.json" and "requirements.txt".

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ async function run(
109109
reachAnalysisMemoryLimit,
110110
reachAnalysisTimeout,
111111
reachDisableAnalytics,
112+
reachSkipCache,
112113
} = cli.flags as {
113114
cwd: string
114115
interactive: boolean
@@ -118,6 +119,7 @@ async function run(
118119
reachAnalysisTimeout: number
119120
reachAnalysisMemoryLimit: number
120121
reachDisableAnalytics: boolean
122+
reachSkipCache: boolean
121123
}
122124

123125
const dryRun = !!cli.flags['dryRun']
@@ -204,6 +206,7 @@ async function run(
204206
reachDisableAnalytics: Boolean(reachDisableAnalytics),
205207
reachEcosystems,
206208
reachExcludePaths,
209+
reachSkipCache: Boolean(reachSkipCache),
207210
},
208211
})
209212
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ describe('socket scan reach', async () => {
3434
--reach-disable-analytics Disable reachability analytics sharing with Socket. Also disables caching-based optimizations.
3535
--reach-ecosystems List of ecosystems to conduct reachability analysis on, as either a comma separated value or as multiple flags. Defaults to all ecosystems.
3636
--reach-exclude-paths List of paths to exclude from reachability analysis, as either a comma separated value or as multiple flags.
37+
--reach-skip-cache Skip caching-based optimizations. By default, the reachability analysis will use cached configurations from previous runs to speed up the analysis.
3738
3839
Runs the Socket reachability analysis without creating a scan in Socket.
3940
The output is written to .socket.facts.json in the current working directory.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ async function scanOneRepo(
246246
reachAnalysisMemoryLimit: 0,
247247
reachEcosystems: [],
248248
reachExcludePaths: [],
249+
reachSkipCache: false,
249250
},
250251
readOnly: false,
251252
repoName: repoSlug,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export type ReachabilityOptions = {
2222
reachDisableAnalytics: boolean
2323
reachEcosystems: PURL_Type[]
2424
reachExcludePaths: string[]
25+
reachSkipCache: boolean
2526
}
2627

2728
export type ReachabilityAnalysisOptions = {
@@ -161,6 +162,7 @@ export async function performReachabilityAnalysis(
161162
...(reachabilityOptions.reachExcludePaths.length
162163
? ['--exclude-dirs', ...reachabilityOptions.reachExcludePaths]
163164
: []),
165+
...(reachabilityOptions.reachSkipCache ? ['--skip-cache-usage'] : []),
164166
]
165167

166168
// Build environment variables.

0 commit comments

Comments
 (0)