Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Int 9845 fix #214

Merged
merged 3 commits into from
Dec 6, 2023
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
11 changes: 10 additions & 1 deletion src/steps/chrome-extensions/converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function createChromeExtensionEntity(
entityData: {
source: data,
assign: {
_key: generateEntityKey(entities.CHROME_EXTENSION._type, data.appId),
_key: createChromeExtensionEntityKey(data),
_type: entities.CHROME_EXTENSION._type,
_class: entities.CHROME_EXTENSION._class,
id: data.appId || 'UNKNOWN',
Expand All @@ -34,6 +34,15 @@ export function createChromeExtensionEntity(
});
}

export const createChromeExtensionEntityKey = (
data: chromemanagement_v1.Schema$GoogleChromeManagementV1InstalledApp,
): string => {
return generateEntityKey(
entities.CHROME_EXTENSION._type,
`${data.appId}_${data.appInstallType}_${data.appSource}`,
);
};

export function createChromeOsDeviceInstalledChromeExtensionRelationship(params: {
deviceEntity: Entity;
extensionEntity: Entity;
Expand Down
12 changes: 6 additions & 6 deletions src/steps/chrome-extensions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import {
} from '@jupiterone/integration-sdk-core';
import { IntegrationConfig, IntegrationStepContext } from '../../types';
import { entities, IngestionSources, Steps } from '../../constants';
import { createChromeExtensionEntity } from './converters';
import {
createChromeExtensionEntity,
createChromeExtensionEntityKey,
} from './converters';
import { GSuiteInstalledAppsClient } from '../../gsuite/clients/GSuiteInstalledAppsClient';
import { chromemanagement_v1 } from 'googleapis';
import { RawInstalledAppEntity } from './types';
import { authorizationErrorResponses } from '../../gsuite/clients/GSuiteClient';
import generateEntityKey from '../../utils/generateEntityKey';

const APP_EXTENSION_TYPE = 'EXTENSION';

Expand All @@ -27,10 +29,8 @@ export async function fetchChromeExtensions({
try {
await client.iterateInstalledApps(APP_EXTENSION_TYPE, async (app) => {
if (
!isValidInstalledAppEntity(app) &&
!jobState.hasKey(
generateEntityKey(entities.CHROME_EXTENSION._type, app.appId),
)
!isValidInstalledAppEntity(app) ||
jobState.hasKey(createChromeExtensionEntityKey(app))
) {
return;
}
Expand Down
Loading