Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #172 from JupiterOne/INT-9590-update
Browse files Browse the repository at this point in the history
INT-9590: update Vulnerability is CVE relationship
  • Loading branch information
gastonyelmini authored Oct 5, 2023
2 parents 4e38ff8 + 698f297 commit ce01b4d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/jupiterone/converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
MappedRelationship,
convertProperties,
createIntegrationEntity,
getRawData,
parseTimePropertyValue,
} from '@jupiterone/integration-sdk-core';
import { Entities, MappedRelationships } from '../steps/constants';
Expand Down Expand Up @@ -242,17 +243,18 @@ export function createCVEEntity(cveId: string, cveLink?: string) {
export function createFindingCVEMappedRelationship(
finding: Entity,
): MappedRelationship | undefined {
if (typeof finding.id === 'string') {
const findingRawData = getRawData<Vulnerability>(finding);
if (typeof findingRawData?.cve.id === 'string') {
return {
_key: `${finding._key}|is|${finding.id.toLowerCase()}`,
_key: `${finding._key}|is|${findingRawData?.cve.id.toLowerCase()}`,
_type: `${finding._type}_is_cve`,
_class: 'IS',
displayName: 'IS',
_mapping: {
sourceEntityKey: finding._key,
relationshipDirection: MappedRelationships.VULN_IS_CVE.direction,
targetFilterKeys: [['_type', '_key']],
targetEntity: createCVEEntity(finding.id, finding.webLink),
targetEntity: createCVEEntity(findingRawData?.cve.id, finding.webLink),
},
};
}
Expand Down

0 comments on commit ce01b4d

Please sign in to comment.