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

Commit

Permalink
filter params added
Browse files Browse the repository at this point in the history
  • Loading branch information
Bharatkk-metron committed Jul 24, 2024
1 parent 29be46f commit 7ed5a16
Show file tree
Hide file tree
Showing 17 changed files with 37,744 additions and 596 deletions.
17 changes: 16 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
BASE_URL=
API_TOKEN=
ENABLE_FINDINGS_INGESTION=
ENABLE_FINDINGS_INGESTION=true/false
SEVERITIES=INFO,MINOR,MAJOR,CRITICAL,BLOCKER
# JUST FOR INFO:
# INFO, MINOR -> LOW in API Version 2
# MAJOR -> MEDIUM in API Version 2
# CRITICAL BLOCKERS -> HIGH in API Version 2
STATUS=OPEN,CONFIRMED,REOPENED,RESOLVED,CLOSED # 0 or more values you can pass from given values
CREATED_IN_LAST=10d # default value is 10 days
#createdInLast: optional
#To retrieve issues created during a time span before the current time (exclusive). Accepted units are 'y' for year, 'm' for month, 'w' for week and 'd' for day. If this parameter is set, createdAfter must not be set
# Example value: 1m2w (1 month 2 weeks)
TYPES=CODE_SMELL,BUG,VULNERABILITY # 0 or more values you can pass from given values
# JUST FOR INFO:
# CODE_SMELL -> MAINTAINABILITY in API Version 2
# BUG -> RELIABILITY in API Version 2
# VULNERABILITY: SECURITY in API Version 2
6,781 changes: 6,781 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ import { integrationSteps } from './steps';
import { SonarqubeIntegrationConfig } from './types';
import validateInvocation from './validateInvocation';
import getStepStartStates from './getStepStartStates';
import { ingestionConfig } from './ingestionConfig';

export const invocationConfig: IntegrationInvocationConfig<SonarqubeIntegrationConfig> = {
instanceConfigFields,
validateInvocation,
getStepStartStates,
integrationSteps,
};
export const invocationConfig: IntegrationInvocationConfig<SonarqubeIntegrationConfig> =
{
instanceConfigFields,
validateInvocation,
getStepStartStates,
integrationSteps,
ingestionConfig,
};
33 changes: 33 additions & 0 deletions src/ingestionConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { IntegrationIngestionConfigFieldMap } from '@jupiterone/integration-sdk-core';
import { INGESTION_SOURCE_IDS } from './steps/constants';

export const ingestionConfig: IntegrationIngestionConfigFieldMap = {
[INGESTION_SOURCE_IDS.ACCOUNT]: {
title: 'Account',
description: 'SonarQube Accounts',
defaultsToDisabled: false,
},

[INGESTION_SOURCE_IDS.FINDINGS]: {
title: 'Users',
description: 'SonarQube Issues',
defaultsToDisabled: false,
},
[INGESTION_SOURCE_IDS.USERS]: {
title: 'Users',
description: 'SonarQube Users',
defaultsToDisabled: false,
},

[INGESTION_SOURCE_IDS.PROJECT]: {
title: 'Projects',
description: 'SonarQube Projects',
defaultsToDisabled: false,
},

[INGESTION_SOURCE_IDS.USER_GROUPS]: {
title: 'User Groups',
description: 'SonarQube Groups',
defaultsToDisabled: false,
},
};
20 changes: 20 additions & 0 deletions src/instanceConfigFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@ const instanceConfigFields: IntegrationInstanceConfigFieldMap = {
mask: false,
optional: true,
},
severities: {
type: 'string',
mask: false,
optional: true,
},
status: {
type: 'string',
mask: false,
optional: true,
},
createdInLast: {
type: 'string',
mask: false,
optional: true,
},
types: {
type: 'string',
mask: false,
optional: true,
},
};

export default instanceConfigFields;
8 changes: 7 additions & 1 deletion src/steps/account/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import {
IntegrationStepExecutionContext,
} from '@jupiterone/integration-sdk-core';

import { ACCOUNT_ENTITY_KEY, Entities, Steps } from '../constants';
import {
ACCOUNT_ENTITY_KEY,
Entities,
INGESTION_SOURCE_IDS,
Steps,
} from '../constants';
import { createAccountEntity } from './converter';
import { SonarqubeIntegrationConfig } from '../../types';

Expand All @@ -19,6 +24,7 @@ export const accountSteps: IntegrationStep<SonarqubeIntegrationConfig>[] = [
{
id: Steps.ACCOUNT,
name: 'Fetch Account',
ingestionSourceId: INGESTION_SOURCE_IDS.ACCOUNT,
entities: [Entities.ACCOUNT],
executionHandler: fetchAccount,
relationships: [],
Expand Down
40 changes: 40 additions & 0 deletions src/steps/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,46 @@ import { RelationshipClass } from '@jupiterone/integration-sdk-core';

export const ACCOUNT_ENTITY_KEY = 'sonarqube:account';

export const FINDINGS_SEVERITIES = {
INFO: 'LOW',
MINOR: 'MEDIUM',
MAJOR: 'MEDIUM',
CRITICAL: 'HIGH',
BLOCKER: 'HIGH',
};

export const V1_SEVERITIES_VALUES = [
'INFO',
'MINOR',
'MAJOR',
'CRITICAL',
'BLOCKER',
];
export const V2_SEVERITIES_VALUES = ['LOW', 'MEDIUM', 'HIGH'];
export const DEFAULT_CREATED_IN_LAST = '10d';

export const FINDING_STATUSES = {
OPEN: 'OPEN',
CONFIRMED: 'CONFIRMED',
REOPENED: 'FALSE_POSITIVE',
RESOLVED: 'ACCEPTED',
CLOSED: 'FIXED',
};

export const FINDING_TYPES = {
CODE_SMELL: 'MAINTAINABILITY',
BUG: 'RELIABILITY',
VULNERABILITY: 'SECURITY',
};

export const INGESTION_SOURCE_IDS = {
ACCOUNT: 'accounts',
PROJECT: 'projects',
USERS: 'users',
USER_GROUPS: 'user-groups',
FINDINGS: 'findings',
};

export const Steps = {
ACCOUNT: 'fetch-account',
PROJECTS: 'fetch-projects',
Expand Down
Loading

0 comments on commit 7ed5a16

Please sign in to comment.