-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* chore: update object * chore: DOC-1520 fixed affected products content logic * chore: update limit * chore: update table to easier scan (cherry picked from commit ace8016) Co-authored-by: Karl Cardenas <29551334+karl-cardenas-coding@users.noreply.github.com>
- Loading branch information
1 parent
9fd8c94
commit a5d2a20
Showing
5 changed files
with
268 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// generates a map of CVEs. Each CVE entry contains information about the impact of the CVE on different products and versions. | ||
function generateCVEMap(cveData) { | ||
const cveImpactMap = {}; | ||
|
||
for (const item of cveData) { | ||
// Let's create a CVE entry in the map if it doesn't exist. | ||
// By default, let's initailize all values to false or empty array. | ||
if (!cveImpactMap[item.metadata.cve]) { | ||
cveImpactMap[item.metadata.cve] = { | ||
palette: { | ||
impacts: false, | ||
versions: [], | ||
}, | ||
paletteAirgap: { | ||
impacts: false, | ||
versions: [], | ||
}, | ||
vertex: { | ||
impacts: false, | ||
versions: [], | ||
}, | ||
vertexAirgap: { | ||
impacts: false, | ||
versions: [], | ||
}, | ||
}; | ||
} | ||
|
||
// Palette Enterprise logic | ||
if (item.spec.impact.impactedProducts.palette && !item.spec.impact.impactedDeployments.airgap) { | ||
cveImpactMap[item.metadata.cve].palette.impacts = true; | ||
cveImpactMap[item.metadata.cve].palette.versions = item.spec.impact.impactedVersions; | ||
} | ||
|
||
// Palette Enterprise Airgap logic | ||
if (item.spec.impact.impactedProducts.palette && item.spec.impact.impactedDeployments.airgap) { | ||
cveImpactMap[item.metadata.cve].paletteAirgap.impacts = true; | ||
cveImpactMap[item.metadata.cve].paletteAirgap.versions = item.spec.impact.impactedVersions; | ||
} | ||
|
||
// Palette VerteX logic | ||
if (item.spec.impact.impactedProducts.vertex && !item.spec.impact.impactedDeployments.airgap) { | ||
cveImpactMap[item.metadata.cve].vertex.impacts = true; | ||
cveImpactMap[item.metadata.cve].vertex.versions = item.spec.impact.impactedVersions; | ||
} | ||
|
||
// Palette VerteX Airgap logic | ||
if (item.spec.impact.impactedProducts.vertex && item.spec.impact.impactedDeployments.airgap) { | ||
cveImpactMap[item.metadata.cve].vertexAirgap.impacts = true; | ||
cveImpactMap[item.metadata.cve].vertexAirgap.versions = item.spec.impact.impactedVersions; | ||
} | ||
} | ||
|
||
return cveImpactMap; | ||
} | ||
|
||
module.exports = { generateCVEMap }; |
Oops, something went wrong.