Skip to content

Commit 28c309c

Browse files
authored
Merge pull request #327 from HoyeongJeon/drop-snyk-support
feat(vulnera): drop Snyk support (#325)
2 parents 21e7fe8 + a99ba34 commit 28c309c

26 files changed

Lines changed: 19 additions & 1014 deletions

File tree

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ The default strategy is **NONE** which mean no strategy at all (we execute nothi
5454
- [GitHub Advisory](./docs/github_advisory.md)
5555
- [Sonatype OSS Index](./docs/sonatype.md)
5656
- [OSV](./docs/osv.md)
57-
- Snyk
5857

5958
Those strategies are described as "string" **type** with the following TypeScript definition:
6059
```ts
61-
type Kind = "github-advisory" | "snyk" | "sonatype" | "osv" | "none";
60+
type Kind = "github-advisory" | "sonatype" | "osv" | "none";
6261
```
6362

6463
To add a strategy or better understand how the code works, please consult [the following guide](./docs/adding_new_strategy.md).
@@ -71,7 +70,6 @@ function getStrategy(): AnyStrategy;
7170

7271
const strategies: Object.freeze({
7372
GITHUB_ADVISORY: "github-advisory",
74-
SNYK: "snyk",
7573
SONATYPE: "sonatype",
7674
OSV: "osv",
7775
NONE: "none"
@@ -133,7 +131,6 @@ Where `dependencies` is the dependencies **Map()** object of the NodeSecure Scan
133131
### Databases
134132
- [OSV](./docs/database/osv.md)
135133
- [NVD](./docs/database/nvd.md)
136-
- [Snyk](./docs/database/snyk.md)
137134
- [Sonatype](./docs/database/sonatype.md)
138135

139136
## Contributors ✨

docs/adding_new_strategy.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ You must add a new constant in variable `VULN_MODE`
7171
```js
7272
export const VULN_MODE = Object.freeze({
7373
GITHUB_ADVISORY: "github-advisory",
74-
SNYK: "snyk",
7574
SONATYPE: "sonatype",
7675
NONE: "none",
7776
MY_NEW_STRATEGY: "foobar" // <-- here

docs/database/snyk.md

Lines changed: 0 additions & 95 deletions
This file was deleted.

docs/formats/standard.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ We provide a high-level format that works for all available strategies. It can b
66
export interface StandardVulnerability {
77
/** Unique identifier for the vulnerability **/
88
id?: string;
9-
/** Vulnerability origin, either Snyk, Sonatype, GitHub or NodeSWG **/
9+
/** Vulnerability origin, either Sonatype, GitHub or OSV **/
1010
origin: Origin;
1111
/** Package associated with the vulnerability **/
1212
package: string;

src/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export const NPM_TOKEN = typeof process.env.NODE_SECURE_TOKEN === "string" ?
33

44
export const VULN_MODE = Object.freeze({
55
GITHUB_ADVISORY: "github-advisory",
6-
SNYK: "snyk",
76
SONATYPE: "sonatype",
87
OSV: "osv",
98
NONE: "none"

src/database/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ export type {
1818
OSVQueryBatchResponse
1919
} from "./osv.ts";
2020

21-
export { Snyk } from "./snyk.ts";
22-
export type {
23-
SnykOptions,
24-
SnykFindOneParameters
25-
} from "./snyk.ts";
26-
2721
export { Sonatype } from "./sonatype.ts";
2822
export type {
2923
SonatypeOptions,

src/database/snyk.ts

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/formats/osv/mappers.ts

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type {
88
} from "./index.ts";
99
import type {
1010
SonatypeVulnerability,
11-
SnykVulnerability,
1211
NpmAuditAdvisory,
1312
PnpmAuditAdvisory
1413
} from "../../index.ts";
@@ -144,60 +143,6 @@ function mapFromPnpm(
144143
};
145144
}
146145

147-
function mapFromSnyk(
148-
vuln: SnykVulnerability
149-
): OSV {
150-
return {
151-
id: vuln.id,
152-
modified: vuln.publicationTime,
153-
published: vuln.disclosureTime ?? vuln.publicationTime,
154-
aliases: vuln.identifiers.CVE ?? [],
155-
upstream: [],
156-
summary: vuln.title,
157-
details: vuln.description,
158-
severity: [
159-
{ type: "CVSS_V3", score: vuln.CVSSv3 }
160-
],
161-
affected: [
162-
{
163-
package: {
164-
ecosystem: "npm",
165-
name: vuln.package,
166-
purl: toPurl(vuln.package)
167-
},
168-
severity: [],
169-
ranges: vuln.semver.vulnerable.map((range) => {
170-
return {
171-
type: "SEMVER",
172-
events: semverRangeToOsvEvents(range),
173-
database_specific: {}
174-
};
175-
}),
176-
versions: vuln.functions.flatMap((f) => f.version),
177-
ecosystem_specific: {},
178-
database_specific: {}
179-
}
180-
],
181-
references: [
182-
{
183-
type: "WEB",
184-
url: vuln.url
185-
}
186-
],
187-
credits: vuln.credit.map((name) => {
188-
return {
189-
name,
190-
contact: [],
191-
type: "FINDER" as const
192-
};
193-
}),
194-
database_specific: {
195-
severity: vuln.severity,
196-
cvssScore: vuln.cvssScore
197-
}
198-
};
199-
}
200-
201146
function mapFromSonatype(
202147
vuln: SonatypeVulnerability
203148
): OSV {
@@ -249,6 +194,5 @@ function mapFromSonatype(
249194
export const OSV_VULN_MAPPERS = Object.freeze({
250195
[VULN_MODE.GITHUB_ADVISORY]: mapFromNPM,
251196
"github-advisory_pnpm": mapFromPnpm,
252-
[VULN_MODE.SNYK]: mapFromSnyk,
253197
[VULN_MODE.SONATYPE]: mapFromSonatype
254198
});

src/formats/snyk/index.ts

Lines changed: 0 additions & 95 deletions
This file was deleted.

src/formats/standard/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface StandardPatch {
1515
export interface StandardVulnerability {
1616
/** Unique identifier for the vulnerability **/
1717
id?: string;
18-
/** Vulnerability origin, either Snyk, Sonatype, GitHub or NodeSWG **/
18+
/** Vulnerability origin, either Sonatype, GitHub or OSV **/
1919
origin: Exclude<Kind, "none">;
2020
/** Package associated with the vulnerability **/
2121
package: string;

0 commit comments

Comments
 (0)