Skip to content

Commit 5a51fc8

Browse files
Merge pull request #44 from JupiterOne/INT-11348-duplicated-vuln-key
Corrected vuln step to avoid duplicated relationships to be created
2 parents b4cc9b2 + a0e5ce1 commit 5a51fc8

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/steps/ms-defender/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { GraphClient, GraphClientResponse } from '../../ms-graph/client';
33
import { IntegrationLogger } from '@jupiterone/integration-sdk-core';
44
import { ClientConfig } from '../../ms-graph/types';
55

6-
const ITEMS_PER_PAGE = 500;
6+
const ITEMS_PER_PAGE = 750;
77
export class DefenderClient extends GraphClient {
88
constructor(logger: IntegrationLogger, config: ClientConfig) {
99
super(logger, { ...config, isDefenderApi: true });

src/steps/ms-defender/vulnerabilities/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
createVulnerabilityCveRelationship,
1818
createVulnerabilityEntity,
1919
createMachineVulnerabilityRelationship,
20-
createVulnerabilityKey,
2120
} from './converters';
2221

2322
export async function fetchFindings({
@@ -44,10 +43,9 @@ export async function fetchFindings({
4443
async (finding) => {
4544
const findingEntity = createVulnerabilityEntity(finding);
4645

47-
if (!jobState.hasKey(createVulnerabilityKey(finding.id))) {
48-
await jobState.addEntity(findingEntity);
49-
}
46+
if (jobState.hasKey(findingEntity._key)) return;
5047

48+
await jobState.addEntity(findingEntity);
5149
await jobState.addRelationship(
5250
createMachineVulnerabilityRelationship({
5351
machineEntity,

0 commit comments

Comments
 (0)