Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions extensions/publisher-cves/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
},
"packages": {},
"files": {
"dist/assets/index-B41wDw7-.js": {
"checksum": "6f226fcbe63e27f856c8755bfa5f2cdc"
},
"dist/assets/index-CteWUkOR.css": {
"checksum": "e26ddbd6163e429121aaac82256c8f53"
},
"dist/assets/index-vlEy0F6m.js": {
"checksum": "da2cb1d917ec752760f9186b7d02d185"
},
"dist/index.html": {
"checksum": "0fed520b0a89f55e25e1bbce548aa482"
"checksum": "69a4a2125195046f07166dbdd55fcf8b"
},
"main.py": {
"checksum": "f8385dbd8a8cd24204f1eb6209f8bb30"
Expand Down
22 changes: 12 additions & 10 deletions extensions/publisher-cves/src/components/VulnerabilityChecker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { useVulnsStore } from "../stores/vulns";
import { usePackagesStore } from "../stores/packages";
import { useContentStore } from "../stores/content";
import type { Vulnerability } from "../stores/vulns";
import type { Vulnerability, VulnerabilityRange } from "../stores/vulns";
import type { Package } from "../stores/packages";
import { computed } from "vue";

Expand Down Expand Up @@ -68,19 +68,21 @@ function getFixedVersion(vuln: Vulnerability): string | null {
return null;
}

// Look through all ranges
let result: string | null = null;

const getFixedEventValue = (range: VulnerabilityRange): string | null => {
return range.events.find((e) => Boolean(e.fixed))?.fixed || null;
};

for (const range of vuln.ranges) {
// Look for events with a "fixed" property
if (range.events && Array.isArray(range.events)) {
for (const event of range.events) {
if (event.fixed) {
return event.fixed;
}
}
if (range.type === "ECOSYSTEM" && range.events) {
return getFixedEventValue(range);
} else {
result = getFixedEventValue(range);
}
}

return null;
return result;
}

// Go back to content list
Expand Down
18 changes: 11 additions & 7 deletions extensions/publisher-cves/src/stores/vulns.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { defineStore } from "pinia";
import { ref } from "vue";

export interface VulnerabilityEvent {
introduced?: string;
fixed?: string;
}

export interface VulnerabilityRange {
type: string;
events: VulnerabilityEvent[];
}

export interface Vulnerability {
id: string;
versions: Record<string, any>;
ranges: Array<{
type: string;
events: Array<{
introduced?: string;
fixed?: string;
}>;
}>;
ranges: VulnerabilityRange[];
summary: string;
details: string;
modified: string;
Expand Down