Skip to content

Commit a63ece7

Browse files
authored
Publisher CVEs: Prefer ECOSYSTEM fixed event (#197)
* Prefer ECOSYSTEM fixed event * Update manifest checksums
1 parent 2679f33 commit a63ece7

File tree

3 files changed

+27
-21
lines changed

3 files changed

+27
-21
lines changed

extensions/publisher-cves/manifest.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
},
2121
"packages": {},
2222
"files": {
23+
"dist/assets/index-B41wDw7-.js": {
24+
"checksum": "6f226fcbe63e27f856c8755bfa5f2cdc"
25+
},
2326
"dist/assets/index-CteWUkOR.css": {
2427
"checksum": "e26ddbd6163e429121aaac82256c8f53"
2528
},
26-
"dist/assets/index-vlEy0F6m.js": {
27-
"checksum": "da2cb1d917ec752760f9186b7d02d185"
28-
},
2929
"dist/index.html": {
30-
"checksum": "0fed520b0a89f55e25e1bbce548aa482"
30+
"checksum": "69a4a2125195046f07166dbdd55fcf8b"
3131
},
3232
"main.py": {
3333
"checksum": "f8385dbd8a8cd24204f1eb6209f8bb30"

extensions/publisher-cves/src/components/VulnerabilityChecker.vue

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { useVulnsStore } from "../stores/vulns";
33
import { usePackagesStore } from "../stores/packages";
44
import { useContentStore } from "../stores/content";
5-
import type { Vulnerability } from "../stores/vulns";
5+
import type { Vulnerability, VulnerabilityRange } from "../stores/vulns";
66
import type { Package } from "../stores/packages";
77
import { computed } from "vue";
88
@@ -68,19 +68,21 @@ function getFixedVersion(vuln: Vulnerability): string | null {
6868
return null;
6969
}
7070
71-
// Look through all ranges
71+
let result: string | null = null;
72+
73+
const getFixedEventValue = (range: VulnerabilityRange): string | null => {
74+
return range.events.find((e) => Boolean(e.fixed))?.fixed || null;
75+
};
76+
7277
for (const range of vuln.ranges) {
73-
// Look for events with a "fixed" property
74-
if (range.events && Array.isArray(range.events)) {
75-
for (const event of range.events) {
76-
if (event.fixed) {
77-
return event.fixed;
78-
}
79-
}
78+
if (range.type === "ECOSYSTEM" && range.events) {
79+
return getFixedEventValue(range);
80+
} else {
81+
result = getFixedEventValue(range);
8082
}
8183
}
8284
83-
return null;
85+
return result;
8486
}
8587
8688
// Go back to content list

extensions/publisher-cves/src/stores/vulns.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
import { defineStore } from "pinia";
22
import { ref } from "vue";
33

4+
export interface VulnerabilityEvent {
5+
introduced?: string;
6+
fixed?: string;
7+
}
8+
9+
export interface VulnerabilityRange {
10+
type: string;
11+
events: VulnerabilityEvent[];
12+
}
13+
414
export interface Vulnerability {
515
id: string;
616
versions: Record<string, any>;
7-
ranges: Array<{
8-
type: string;
9-
events: Array<{
10-
introduced?: string;
11-
fixed?: string;
12-
}>;
13-
}>;
17+
ranges: VulnerabilityRange[];
1418
summary: string;
1519
details: string;
1620
modified: string;

0 commit comments

Comments
 (0)