Skip to content

Commit 1ea9f54

Browse files
committed
use the new Coana CLI flag --purl-types instead of computing --reach-ecosystems to legacy Coana-compatible advisory ecosystems
1 parent 17030c6 commit 1ea9f54

File tree

2 files changed

+2
-51
lines changed

2 files changed

+2
-51
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ import {
44
extractTier1ReachabilityScanId,
55
spawnCoana,
66
} from '../../utils/coana.mts'
7-
import { convertToCoanaEcosystems } from '../../utils/ecosystem.mts'
87
import { setupSdk } from '../../utils/sdk.mts'
98

109
import type { CResult } from '../../types.mts'
11-
import type { PURL_Type } from '../../utils/ecosystem.mts'
1210
import type { Spinner } from '@socketsecurity/registry/lib/spinner'
11+
import type { PURL_Type } from '../../utils/ecosystem.mts'
1312

1413
export type ReachabilityOptions = {
1514
reachDisableAnalytics: boolean
@@ -141,10 +140,7 @@ export async function performReachabilityAnalysis(
141140
: []),
142141
// empty reachEcosystems implies scan all ecosystems
143142
...(reachabilityOptions.reachEcosystems.length
144-
? [
145-
'--ecosystems',
146-
...convertToCoanaEcosystems(reachabilityOptions.reachEcosystems),
147-
]
143+
? ['--purl-types', ...reachabilityOptions.reachEcosystems]
148144
: []),
149145
...(reachabilityOptions.reachExcludePaths.length
150146
? ['--exclude-dirs', reachabilityOptions.reachExcludePaths.join(' ')]

src/utils/ecosystem.mts

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -55,53 +55,8 @@ export type _Check_ALL_ECOSYSTEMS_has_all_purl_types =
5555
export type _Check_ALL_ECOSYSTEMS_has_no_extras =
5656
ExpectNever<ExtraInAllEcosystems>
5757

58-
const COANA_SUPPORTED_LIST = [
59-
'composer',
60-
'hex',
61-
'github',
62-
'golang',
63-
'maven',
64-
'npm',
65-
'nuget',
66-
'pypi',
67-
'pub',
68-
'gem',
69-
'cargo',
70-
'swift',
71-
] as const satisfies readonly PURL_Type[]
72-
7358
export const ALL_SUPPORTED_ECOSYSTEMS = new Set<string>(ALL_ECOSYSTEMS)
7459

75-
export const COANA_SUPPORTED_ECOSYSTEMS = new Set<string>(COANA_SUPPORTED_LIST)
76-
77-
/**
78-
* Ecosystems/Purl types are slightly different in Coana. This function converts
79-
* the PURL_Type[] to a string of Coana compatible ecosystem names. Ecosystems that
80-
* are not supported by Coana are ignored.
81-
*/
82-
export function convertToCoanaEcosystems(ecosystems: PURL_Type[]): string[] {
83-
return ecosystems
84-
.filter(ecosystem => COANA_SUPPORTED_ECOSYSTEMS.has(ecosystem as PURL_Type))
85-
.map(ecosystem => {
86-
switch (ecosystem) {
87-
case 'cargo':
88-
return 'RUST'
89-
case 'gem':
90-
return 'RUBYGEMS'
91-
case 'github':
92-
return 'ACTIONS'
93-
case 'golang':
94-
return 'GO'
95-
case 'hex':
96-
return 'ERLANG'
97-
case 'pypi':
98-
return 'PIP'
99-
default:
100-
return ecosystem.toUpperCase()
101-
}
102-
})
103-
}
104-
10560
export function getEcosystemChoicesForMeow(): string[] {
10661
return [...ALL_ECOSYSTEMS]
10762
}

0 commit comments

Comments
 (0)