From 9c2d878408b8ec0675dd61178193775f574a0a60 Mon Sep 17 00:00:00 2001 From: bharatkk-metron Date: Fri, 2 Aug 2024 12:37:22 +0530 Subject: [PATCH] review changes --- .env.example | 2 +- src/getStepStartStates.ts | 4 +- src/ingestionConfig.ts | 5 - src/instanceConfigFields.ts | 8 +- src/provider/types/common.ts | 7 +- src/steps/account/converter.ts | 2 +- src/steps/constants.ts | 2 +- .../fetch-findings_4198425312/recording.har | 168 +++++++----------- src/steps/finding/index.ts | 69 +++---- src/types.ts | 8 +- src/validateInvocation.test.ts | 43 +++-- src/validateInvocation.ts | 87 +++++++++ test/config.ts | 5 +- 13 files changed, 212 insertions(+), 198 deletions(-) diff --git a/.env.example b/.env.example index d27ebfd..df9a3df 100644 --- a/.env.example +++ b/.env.example @@ -19,7 +19,7 @@ STATUS=OPEN,CONFIRMED,REOPENED,RESOLVED,CLOSED #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) -CREATED_IN_LAST=10d # default value is 10 days +FINDINGS_INGEST_SINCE_DAYS=90 # default value is 90 days # CODE_SMELL -> MAINTAINABILITY in API Version 2 # BUG -> RELIABILITY in API Version 2 diff --git a/src/getStepStartStates.ts b/src/getStepStartStates.ts index 52c301c..39ba719 100644 --- a/src/getStepStartStates.ts +++ b/src/getStepStartStates.ts @@ -10,8 +10,8 @@ export default function getStepStartStates( ): StepStartStates { context.logger.warn( { - enableFindingsIngestion: !!context.instance.config - .enableFindingsIngestion, + enableFindingsIngestion: + !!context.instance.config.enableFindingsIngestion, }, 'Findings ingestion flag', ); diff --git a/src/ingestionConfig.ts b/src/ingestionConfig.ts index c322347..285b257 100644 --- a/src/ingestionConfig.ts +++ b/src/ingestionConfig.ts @@ -2,11 +2,6 @@ import { IntegrationIngestionConfigFieldMap } from '@jupiterone/integration-sdk- 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', diff --git a/src/instanceConfigFields.ts b/src/instanceConfigFields.ts index fc10815..97868be 100644 --- a/src/instanceConfigFields.ts +++ b/src/instanceConfigFields.ts @@ -13,22 +13,22 @@ const instanceConfigFields: IntegrationInstanceConfigFieldMap = { mask: false, optional: true, }, - severities: { + findingsSeverities: { type: 'string', mask: false, optional: true, }, - status: { + findingStatus: { type: 'string', mask: false, optional: true, }, - createdInLast: { + findingsIngestSinceDays: { type: 'string', mask: false, optional: true, }, - types: { + findingTypes: { type: 'string', mask: false, optional: true, diff --git a/src/provider/types/common.ts b/src/provider/types/common.ts index 98f33a6..7e78227 100644 --- a/src/provider/types/common.ts +++ b/src/provider/types/common.ts @@ -27,7 +27,6 @@ export interface Pagination { export type PaginatedResponse = { [Key in 'paging' | 'page']: Pagination; -} & - { - [K in T]: U[]; - }; +} & { + [K in T]: U[]; +}; diff --git a/src/steps/account/converter.ts b/src/steps/account/converter.ts index bdf3d0f..8f83d55 100644 --- a/src/steps/account/converter.ts +++ b/src/steps/account/converter.ts @@ -26,7 +26,7 @@ export function createAccountEntity( _class: Entities.ACCOUNT._class, id, name, - vendor: 'SonarSource' + vendor: 'SonarSource', }, }, }); diff --git a/src/steps/constants.ts b/src/steps/constants.ts index 739940d..8dfc854 100644 --- a/src/steps/constants.ts +++ b/src/steps/constants.ts @@ -18,7 +18,7 @@ export const V1_SEVERITIES_VALUES = [ 'BLOCKER', ]; export const V2_SEVERITIES_VALUES = ['LOW', 'MEDIUM', 'HIGH']; -export const DEFAULT_CREATED_IN_LAST = '10d'; +export const DEFAULT_FINDING_INGEST_SINCE_DAYS = 90; export const FINDING_STATUSES = { OPEN: 'OPEN', diff --git a/src/steps/finding/__recordings__/fetch-findings_4198425312/recording.har b/src/steps/finding/__recordings__/fetch-findings_4198425312/recording.har index f89c433..c50095e 100644 --- a/src/steps/finding/__recordings__/fetch-findings_4198425312/recording.har +++ b/src/steps/finding/__recordings__/fetch-findings_4198425312/recording.har @@ -280,7 +280,7 @@ } }, { - "_id": "11c41b7a65f6eaf7e0c47e792354858b", + "_id": "7c67bad20a8c64dfb86d9fb64d0ed511", "_order": 0, "cache": {}, "request": { @@ -312,7 +312,7 @@ "value": "localhost:9000" } ], - "headersSize": 391, + "headersSize": 352, "httpVersion": "HTTP/1.1", "method": "GET", "queryString": [ @@ -328,31 +328,23 @@ "name": "componentKeys", "value": "test-project-2" }, - { - "name": "issueStatuses", - "value": "" - }, - { - "name": "impactSoftwareQualities", - "value": "" - }, { "name": "createdInLast", - "value": "1m" + "value": "90d" }, { "name": "impactSeverities", "value": "LOW" } ], - "url": "http://localhost:9000/api/issues/search?p=1&ps=100&componentKeys=test-project-2&issueStatuses=&impactSoftwareQualities=&createdInLast=1m&impactSeverities=LOW" + "url": "http://localhost:9000/api/issues/search?p=1&ps=100&componentKeys=test-project-2&createdInLast=90d&impactSeverities=LOW" }, "response": { - "bodySize": 1029, + "bodySize": 2147, "content": { "mimeType": "application/json", - "size": 1029, - "text": "{\"total\":1,\"p\":1,\"ps\":100,\"paging\":{\"pageIndex\":1,\"pageSize\":100,\"total\":1},\"effortTotal\":5,\"issues\":[{\"key\":\"538abb5e-86ba-4a6e-8c1b-383a17adace0\",\"rule\":\"typescript:S6606\",\"severity\":\"MINOR\",\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"project\":\"test-project-2\",\"line\":65,\"hash\":\"8dbd5e5eb8ef6f2b28c4daadf59945c2\",\"textRange\":{\"startLine\":65,\"endLine\":65,\"startOffset\":43,\"endOffset\":45},\"flows\":[],\"status\":\"OPEN\",\"message\":\"Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.\",\"effort\":\"5min\",\"debt\":\"5min\",\"author\":\"bharat.kumavat@metronlabs.com\",\"tags\":[\"type-dependent\",\"nullish-coalescing\",\"es2020\"],\"creationDate\":\"2024-06-27T05:29:54+0000\",\"updateDate\":\"2024-07-24T10:30:06+0000\",\"type\":\"CODE_SMELL\",\"scope\":\"MAIN\",\"quickFixAvailable\":true,\"messageFormattings\":[],\"codeVariants\":[],\"cleanCodeAttribute\":\"CONVENTIONAL\",\"cleanCodeAttributeCategory\":\"CONSISTENT\",\"impacts\":[{\"softwareQuality\":\"MAINTAINABILITY\",\"severity\":\"LOW\"}],\"issueStatus\":\"OPEN\",\"prioritizedRule\":false}],\"components\":[{\"key\":\"test-project-2\",\"enabled\":true,\"qualifier\":\"TRK\",\"name\":\"test-project-2\",\"longName\":\"test-project-2\"},{\"key\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"enabled\":true,\"qualifier\":\"FIL\",\"name\":\"client.ts\",\"longName\":\"src/steps/active-directory/conditional-access-policy/client.ts\",\"path\":\"src/steps/active-directory/conditional-access-policy/client.ts\"}],\"facets\":[]}" + "size": 2147, + "text": "{\"total\":8,\"p\":1,\"ps\":100,\"paging\":{\"pageIndex\":1,\"pageSize\":100,\"total\":8},\"effortTotal\":28,\"issues\":[{\"key\":\"538abb5e-86ba-4a6e-8c1b-383a17adace0\",\"rule\":\"typescript:S6606\",\"severity\":\"MINOR\",\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"project\":\"test-project-2\",\"line\":65,\"hash\":\"8dbd5e5eb8ef6f2b28c4daadf59945c2\",\"textRange\":{\"startLine\":65,\"endLine\":65,\"startOffset\":43,\"endOffset\":45},\"flows\":[],\"status\":\"OPEN\",\"message\":\"Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.\",\"effort\":\"5min\",\"debt\":\"5min\",\"author\":\"bharat.kumavat@metronlabs.com\",\"tags\":[\"type-dependent\",\"nullish-coalescing\",\"es2020\"],\"creationDate\":\"2024-06-27T05:29:54+0000\",\"updateDate\":\"2024-07-24T10:30:06+0000\",\"type\":\"CODE_SMELL\",\"scope\":\"MAIN\",\"quickFixAvailable\":true,\"messageFormattings\":[],\"codeVariants\":[],\"cleanCodeAttribute\":\"CONVENTIONAL\",\"cleanCodeAttributeCategory\":\"CONSISTENT\",\"impacts\":[{\"softwareQuality\":\"MAINTAINABILITY\",\"severity\":\"LOW\"}],\"issueStatus\":\"OPEN\",\"prioritizedRule\":false},{\"key\":\"0814f3b1-33d9-48b2-9185-54e01be729a2\",\"rule\":\"typescript:S4325\",\"severity\":\"MINOR\",\"component\":\"test-project-2:src/steps/active-directory/access-groups/index.ts\",\"project\":\"test-project-2\",\"line\":379,\"hash\":\"afd4719db0b92e099f16d86b34afe364\",\"textRange\":{\"startLine\":379,\"endLine\":379,\"startOffset\":35,\"endOffset\":60},\"flows\":[],\"status\":\"OPEN\",\"message\":\"This assertion is unnecessary since it does not change the type of the expression.\",\"effort\":\"1min\",\"debt\":\"1min\",\"author\":\"gonzalo.avalos.ribas@contractor.jupiterone.com\",\"tags\":[\"type-dependent\",\"redundant\"],\"creationDate\":\"2024-05-28T13:57:11+0000\",\"updateDate\":\"2024-07-24T10:30:06+0000\",\"type\":\"CODE_SMELL\",\"scope\":\"MAIN\",\"quickFixAvailable\":true,\"messageFormattings\":[],\"codeVariants\":[],\"cleanCodeAttribute\":\"CLEAR\",\"cleanCodeAttributeCategory\":\"INTENTIONAL\",\"impacts\":[{\"softwareQuality\":\"MAINTAINABILITY\",\"severity\":\"LOW\"}],\"issueStatus\":\"OPEN\",\"prioritizedRule\":false},{\"key\":\"f520a273-fdd0-4921-935d-168d7688b4b2\",\"rule\":\"typescript:S4325\",\"severity\":\"MINOR\",\"component\":\"test-project-2:src/steps/resource-manager/synapse/index.ts\",\"project\":\"test-project-2\",\"line\":84,\"hash\":\"12760556e2d1b413b93e5eb14206ee0f\",\"textRange\":{\"startLine\":84,\"endLine\":84,\"startOffset\":19,\"endOffset\":52},\"flows\":[],\"status\":\"OPEN\",\"message\":\"This assertion is unnecessary since it does not change the type of the expression.\",\"effort\":\"1min\",\"debt\":\"1min\",\"author\":\"gonzalo.avalos.ribas@contractor.jupiterone.com\",\"tags\":[\"type-dependent\",\"redundant\"],\"creationDate\":\"2024-05-23T13:33:19+0000\",\"updateDate\":\"2024-07-24T10:30:06+0000\",\"type\":\"CODE_SMELL\",\"scope\":\"MAIN\",\"quickFixAvailable\":true,\"messageFormattings\":[],\"codeVariants\":[],\"cleanCodeAttribute\":\"CLEAR\",\"cleanCodeAttributeCategory\":\"INTENTIONAL\",\"impacts\":[{\"softwareQuality\":\"MAINTAINABILITY\",\"severity\":\"LOW\"}],\"issueStatus\":\"OPEN\",\"prioritizedRule\":false},{\"key\":\"0590174a-c902-43b6-8270-baed7e5a7b75\",\"rule\":\"typescript:S6594\",\"severity\":\"MINOR\",\"component\":\"test-project-2:src/steps/active-directory/access-groups/index.ts\",\"project\":\"test-project-2\",\"line\":376,\"hash\":\"8edc1f3ffee0ef86a03e65232ad9c5ad\",\"textRange\":{\"startLine\":376,\"endLine\":376,\"startOffset\":36,\"endOffset\":41},\"flows\":[],\"status\":\"OPEN\",\"message\":\"Use the \\\"RegExp.exec()\\\" method instead.\",\"effort\":\"5min\",\"debt\":\"5min\",\"author\":\"poornima@metronlabs.com\",\"tags\":[\"regex\",\"type-dependent\"],\"creationDate\":\"2024-05-23T13:06:47+0000\",\"updateDate\":\"2024-07-24T10:30:06+0000\",\"type\":\"CODE_SMELL\",\"scope\":\"MAIN\",\"quickFixAvailable\":true,\"messageFormattings\":[],\"codeVariants\":[],\"cleanCodeAttribute\":\"EFFICIENT\",\"cleanCodeAttributeCategory\":\"INTENTIONAL\",\"impacts\":[{\"softwareQuality\":\"MAINTAINABILITY\",\"severity\":\"LOW\"}],\"issueStatus\":\"OPEN\",\"prioritizedRule\":false},{\"key\":\"cfda2dcf-9fd5-41bd-8c24-794e164a1379\",\"rule\":\"typescript:S6594\",\"severity\":\"MINOR\",\"component\":\"test-project-2:src/steps/active-directory/access-groups/index.ts\",\"project\":\"test-project-2\",\"line\":206,\"hash\":\"8edc1f3ffee0ef86a03e65232ad9c5ad\",\"textRange\":{\"startLine\":206,\"endLine\":206,\"startOffset\":36,\"endOffset\":41},\"flows\":[],\"status\":\"OPEN\",\"message\":\"Use the \\\"RegExp.exec()\\\" method instead.\",\"effort\":\"5min\",\"debt\":\"5min\",\"author\":\"poornima@metronlabs.com\",\"tags\":[\"regex\",\"type-dependent\"],\"creationDate\":\"2024-05-17T10:39:19+0000\",\"updateDate\":\"2024-07-24T10:30:06+0000\",\"type\":\"CODE_SMELL\",\"scope\":\"MAIN\",\"quickFixAvailable\":true,\"messageFormattings\":[],\"codeVariants\":[],\"cleanCodeAttribute\":\"EFFICIENT\",\"cleanCodeAttributeCategory\":\"INTENTIONAL\",\"impacts\":[{\"softwareQuality\":\"MAINTAINABILITY\",\"severity\":\"LOW\"}],\"issueStatus\":\"OPEN\",\"prioritizedRule\":false},{\"key\":\"ccc5114b-0d6c-474f-818a-bb39a267417f\",\"rule\":\"typescript:S6606\",\"severity\":\"MINOR\",\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"project\":\"test-project-2\",\"line\":117,\"hash\":\"8dbd5e5eb8ef6f2b28c4daadf59945c2\",\"textRange\":{\"startLine\":117,\"endLine\":117,\"startOffset\":43,\"endOffset\":45},\"flows\":[],\"status\":\"OPEN\",\"message\":\"Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.\",\"effort\":\"5min\",\"debt\":\"5min\",\"author\":\"poornima@metronlabs.com\",\"tags\":[\"type-dependent\",\"nullish-coalescing\",\"es2020\"],\"creationDate\":\"2024-05-15T11:20:04+0000\",\"updateDate\":\"2024-07-24T10:30:06+0000\",\"type\":\"CODE_SMELL\",\"scope\":\"MAIN\",\"quickFixAvailable\":true,\"messageFormattings\":[],\"codeVariants\":[],\"cleanCodeAttribute\":\"CONVENTIONAL\",\"cleanCodeAttributeCategory\":\"CONSISTENT\",\"impacts\":[{\"softwareQuality\":\"MAINTAINABILITY\",\"severity\":\"LOW\"}],\"issueStatus\":\"OPEN\",\"prioritizedRule\":false},{\"key\":\"34acb67a-2d43-4231-b2dd-90a310242b9b\",\"rule\":\"typescript:S6606\",\"severity\":\"MINOR\",\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"project\":\"test-project-2\",\"line\":180,\"hash\":\"8dbd5e5eb8ef6f2b28c4daadf59945c2\",\"textRange\":{\"startLine\":180,\"endLine\":180,\"startOffset\":43,\"endOffset\":45},\"flows\":[],\"status\":\"OPEN\",\"message\":\"Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.\",\"effort\":\"5min\",\"debt\":\"5min\",\"author\":\"poornima@metronlabs.com\",\"tags\":[\"type-dependent\",\"nullish-coalescing\",\"es2020\"],\"creationDate\":\"2024-05-15T11:20:04+0000\",\"updateDate\":\"2024-07-24T10:30:06+0000\",\"type\":\"CODE_SMELL\",\"scope\":\"MAIN\",\"quickFixAvailable\":true,\"messageFormattings\":[],\"codeVariants\":[],\"cleanCodeAttribute\":\"CONVENTIONAL\",\"cleanCodeAttributeCategory\":\"CONSISTENT\",\"impacts\":[{\"softwareQuality\":\"MAINTAINABILITY\",\"severity\":\"LOW\"}],\"issueStatus\":\"OPEN\",\"prioritizedRule\":false},{\"key\":\"d13c3492-5d08-4801-a5fc-dacd6f0c46e2\",\"rule\":\"typescript:S4325\",\"severity\":\"MINOR\",\"component\":\"test-project-2:src/steps/active-directory/access-groups/converters.ts\",\"project\":\"test-project-2\",\"line\":153,\"hash\":\"94b2eb1f72041406472a82e15c7eacef\",\"textRange\":{\"startLine\":153,\"endLine\":153,\"startOffset\":14,\"endOffset\":55},\"flows\":[],\"status\":\"OPEN\",\"message\":\"This assertion is unnecessary since it does not change the type of the expression.\",\"effort\":\"1min\",\"debt\":\"1min\",\"author\":\"poornima@metronlabs.com\",\"tags\":[\"type-dependent\",\"redundant\"],\"creationDate\":\"2024-05-15T11:20:04+0000\",\"updateDate\":\"2024-07-24T10:30:06+0000\",\"type\":\"CODE_SMELL\",\"scope\":\"MAIN\",\"quickFixAvailable\":true,\"messageFormattings\":[],\"codeVariants\":[],\"cleanCodeAttribute\":\"CLEAR\",\"cleanCodeAttributeCategory\":\"INTENTIONAL\",\"impacts\":[{\"softwareQuality\":\"MAINTAINABILITY\",\"severity\":\"LOW\"}],\"issueStatus\":\"OPEN\",\"prioritizedRule\":false}],\"components\":[{\"key\":\"test-project-2:src/steps/resource-manager/synapse/index.ts\",\"enabled\":true,\"qualifier\":\"FIL\",\"name\":\"index.ts\",\"longName\":\"src/steps/resource-manager/synapse/index.ts\",\"path\":\"src/steps/resource-manager/synapse/index.ts\"},{\"key\":\"test-project-2\",\"enabled\":true,\"qualifier\":\"TRK\",\"name\":\"test-project-2\",\"longName\":\"test-project-2\"},{\"key\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"enabled\":true,\"qualifier\":\"FIL\",\"name\":\"client.ts\",\"longName\":\"src/steps/active-directory/access-groups/client.ts\",\"path\":\"src/steps/active-directory/access-groups/client.ts\"},{\"key\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"enabled\":true,\"qualifier\":\"FIL\",\"name\":\"client.ts\",\"longName\":\"src/steps/active-directory/conditional-access-policy/client.ts\",\"path\":\"src/steps/active-directory/conditional-access-policy/client.ts\"},{\"key\":\"test-project-2:src/steps/active-directory/access-groups/converters.ts\",\"enabled\":true,\"qualifier\":\"FIL\",\"name\":\"converters.ts\",\"longName\":\"src/steps/active-directory/access-groups/converters.ts\",\"path\":\"src/steps/active-directory/access-groups/converters.ts\"},{\"key\":\"test-project-2:src/steps/active-directory/access-groups/index.ts\",\"enabled\":true,\"qualifier\":\"FIL\",\"name\":\"index.ts\",\"longName\":\"src/steps/active-directory/access-groups/index.ts\",\"path\":\"src/steps/active-directory/access-groups/index.ts\"}],\"facets\":[]}" }, "cookies": [], "headers": [ @@ -410,7 +402,7 @@ }, { "name": "date", - "value": "Wed, 24 Jul 2024 15:03:02 GMT" + "value": "Fri, 02 Aug 2024 06:58:25 GMT" }, { "name": "connection", @@ -423,8 +415,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2024-07-24T15:03:02.362Z", - "time": 61, + "startedDateTime": "2024-08-02T06:58:24.908Z", + "time": 102, "timings": { "blocked": -1, "connect": -1, @@ -432,11 +424,11 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 61 + "wait": 102 } }, { - "_id": "feb42407009880d89d5f685b2c59f2c5", + "_id": "703d3361da4aff28a14aa24d5fa5f46a", "_order": 0, "cache": {}, "request": { @@ -468,7 +460,7 @@ "value": "localhost:9000" } ], - "headersSize": 391, + "headersSize": 352, "httpVersion": "HTTP/1.1", "method": "GET", "queryString": [ @@ -484,31 +476,23 @@ "name": "componentKeys", "value": "test-project-2" }, - { - "name": "issueStatuses", - "value": "" - }, - { - "name": "impactSoftwareQualities", - "value": "" - }, { "name": "createdInLast", - "value": "1m" + "value": "90d" }, { "name": "impactSeverities", "value": "LOW" } ], - "url": "http://localhost:9000/api/issues/search?p=2&ps=100&componentKeys=test-project-2&issueStatuses=&impactSoftwareQualities=&createdInLast=1m&impactSeverities=LOW" + "url": "http://localhost:9000/api/issues/search?p=2&ps=100&componentKeys=test-project-2&createdInLast=90d&impactSeverities=LOW" }, "response": { - "bodySize": 178, + "bodySize": 182, "content": { "mimeType": "application/json", - "size": 178, - "text": "{\"total\":1,\"p\":2,\"ps\":100,\"paging\":{\"pageIndex\":2,\"pageSize\":100,\"total\":1},\"effortTotal\":5,\"issues\":[],\"components\":[],\"facets\":[]}" + "size": 182, + "text": "{\"total\":8,\"p\":2,\"ps\":100,\"paging\":{\"pageIndex\":2,\"pageSize\":100,\"total\":8},\"effortTotal\":28,\"issues\":[],\"components\":[],\"facets\":[]}" }, "cookies": [], "headers": [ @@ -566,7 +550,7 @@ }, { "name": "date", - "value": "Wed, 24 Jul 2024 15:03:02 GMT" + "value": "Fri, 02 Aug 2024 06:58:25 GMT" }, { "name": "connection", @@ -579,8 +563,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2024-07-24T15:03:02.449Z", - "time": 13, + "startedDateTime": "2024-08-02T06:58:25.040Z", + "time": 25, "timings": { "blocked": -1, "connect": -1, @@ -588,11 +572,11 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 13 + "wait": 25 } }, { - "_id": "6b82a38128bd2e0da6639c37bff41dba", + "_id": "8afc08a9f83593230e734456c2993112", "_order": 0, "cache": {}, "request": { @@ -624,7 +608,7 @@ "value": "localhost:9000" } ], - "headersSize": 394, + "headersSize": 355, "httpVersion": "HTTP/1.1", "method": "GET", "queryString": [ @@ -640,24 +624,16 @@ "name": "componentKeys", "value": "test-project-2" }, - { - "name": "issueStatuses", - "value": "" - }, - { - "name": "impactSoftwareQualities", - "value": "" - }, { "name": "createdInLast", - "value": "1m" + "value": "90d" }, { "name": "impactSeverities", "value": "MEDIUM" } ], - "url": "http://localhost:9000/api/issues/search?p=1&ps=100&componentKeys=test-project-2&issueStatuses=&impactSoftwareQualities=&createdInLast=1m&impactSeverities=MEDIUM" + "url": "http://localhost:9000/api/issues/search?p=1&ps=100&componentKeys=test-project-2&createdInLast=90d&impactSeverities=MEDIUM" }, "response": { "bodySize": 1001, @@ -722,7 +698,7 @@ }, { "name": "date", - "value": "Wed, 24 Jul 2024 15:03:02 GMT" + "value": "Fri, 02 Aug 2024 06:58:25 GMT" }, { "name": "connection", @@ -735,8 +711,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2024-07-24T15:03:02.467Z", - "time": 29, + "startedDateTime": "2024-08-02T06:58:25.072Z", + "time": 41, "timings": { "blocked": -1, "connect": -1, @@ -744,11 +720,11 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 29 + "wait": 41 } }, { - "_id": "9e5b0d64d7e79e33f8e0f0e7bef7ee7a", + "_id": "76c6311d95612a5f2ca500dcd91c7ca4", "_order": 0, "cache": {}, "request": { @@ -780,7 +756,7 @@ "value": "localhost:9000" } ], - "headersSize": 394, + "headersSize": 355, "httpVersion": "HTTP/1.1", "method": "GET", "queryString": [ @@ -796,24 +772,16 @@ "name": "componentKeys", "value": "test-project-2" }, - { - "name": "issueStatuses", - "value": "" - }, - { - "name": "impactSoftwareQualities", - "value": "" - }, { "name": "createdInLast", - "value": "1m" + "value": "90d" }, { "name": "impactSeverities", "value": "MEDIUM" } ], - "url": "http://localhost:9000/api/issues/search?p=2&ps=100&componentKeys=test-project-2&issueStatuses=&impactSoftwareQualities=&createdInLast=1m&impactSeverities=MEDIUM" + "url": "http://localhost:9000/api/issues/search?p=2&ps=100&componentKeys=test-project-2&createdInLast=90d&impactSeverities=MEDIUM" }, "response": { "bodySize": 178, @@ -878,7 +846,7 @@ }, { "name": "date", - "value": "Wed, 24 Jul 2024 15:03:02 GMT" + "value": "Fri, 02 Aug 2024 06:58:25 GMT" }, { "name": "connection", @@ -891,8 +859,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2024-07-24T15:03:02.503Z", - "time": 21, + "startedDateTime": "2024-08-02T06:58:25.119Z", + "time": 28, "timings": { "blocked": -1, "connect": -1, @@ -900,11 +868,11 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 21 + "wait": 28 } }, { - "_id": "d09fbd86e3b081e3790744274855a8a6", + "_id": "30f6ca5b71d7e6747bd534bd3fffa898", "_order": 0, "cache": {}, "request": { @@ -936,7 +904,7 @@ "value": "localhost:9000" } ], - "headersSize": 392, + "headersSize": 353, "httpVersion": "HTTP/1.1", "method": "GET", "queryString": [ @@ -952,31 +920,23 @@ "name": "componentKeys", "value": "test-project-2" }, - { - "name": "issueStatuses", - "value": "" - }, - { - "name": "impactSoftwareQualities", - "value": "" - }, { "name": "createdInLast", - "value": "1m" + "value": "90d" }, { "name": "impactSeverities", "value": "HIGH" } ], - "url": "http://localhost:9000/api/issues/search?p=1&ps=100&componentKeys=test-project-2&issueStatuses=&impactSoftwareQualities=&createdInLast=1m&impactSeverities=HIGH" + "url": "http://localhost:9000/api/issues/search?p=1&ps=100&componentKeys=test-project-2&createdInLast=90d&impactSeverities=HIGH" }, "response": { - "bodySize": 1309, + "bodySize": 2607, "content": { "mimeType": "application/json", - "size": 1309, - "text": "{\"total\":1,\"p\":1,\"ps\":100,\"paging\":{\"pageIndex\":1,\"pageSize\":100,\"total\":1},\"effortTotal\":17,\"issues\":[{\"key\":\"03c7ec2c-2f9e-464d-b506-79f7c4dd47a3\",\"rule\":\"typescript:S3776\",\"severity\":\"CRITICAL\",\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"project\":\"test-project-2\",\"line\":53,\"hash\":\"09ad14e4ff4fb5e9bd2c589e2921607c\",\"textRange\":{\"startLine\":53,\"endLine\":53,\"startOffset\":16,\"endOffset\":32},\"flows\":[{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":64,\"endLine\":64,\"startOffset\":6,\"endOffset\":8},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":65,\"endLine\":65,\"startOffset\":43,\"endOffset\":45},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":67,\"endLine\":67,\"startOffset\":8,\"endOffset\":10},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":68,\"endLine\":68,\"startOffset\":10,\"endOffset\":12},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":71,\"endLine\":71,\"startOffset\":10,\"endOffset\":12},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":74,\"endLine\":74,\"startOffset\":10,\"endOffset\":12},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":80,\"endLine\":80,\"startOffset\":8,\"endOffset\":10},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":95,\"endLine\":95,\"startOffset\":10,\"endOffset\":14},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":82,\"endLine\":82,\"startOffset\":10,\"endOffset\":13},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":85,\"endLine\":85,\"startOffset\":14,\"endOffset\":19},\"msg\":\"+4 (incl. 3 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":99,\"endLine\":99,\"startOffset\":6,\"endOffset\":11},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":100,\"endLine\":100,\"startOffset\":6,\"endOffset\":8},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":110,\"endLine\":110,\"startOffset\":8,\"endOffset\":12},\"msg\":\"+1\",\"msgFormattings\":[]}]}],\"status\":\"OPEN\",\"message\":\"Refactor this function to reduce its Cognitive Complexity from 27 to the 15 allowed.\",\"effort\":\"17min\",\"debt\":\"17min\",\"author\":\"bharat.kumavat@metronlabs.com\",\"tags\":[\"brain-overload\"],\"creationDate\":\"2024-06-27T05:29:54+0000\",\"updateDate\":\"2024-07-24T10:30:06+0000\",\"type\":\"CODE_SMELL\",\"scope\":\"MAIN\",\"quickFixAvailable\":false,\"messageFormattings\":[],\"codeVariants\":[],\"cleanCodeAttribute\":\"FOCUSED\",\"cleanCodeAttributeCategory\":\"ADAPTABLE\",\"impacts\":[{\"softwareQuality\":\"MAINTAINABILITY\",\"severity\":\"HIGH\"}],\"issueStatus\":\"OPEN\",\"prioritizedRule\":false}],\"components\":[{\"key\":\"test-project-2\",\"enabled\":true,\"qualifier\":\"TRK\",\"name\":\"test-project-2\",\"longName\":\"test-project-2\"},{\"key\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"enabled\":true,\"qualifier\":\"FIL\",\"name\":\"client.ts\",\"longName\":\"src/steps/active-directory/conditional-access-policy/client.ts\",\"path\":\"src/steps/active-directory/conditional-access-policy/client.ts\"}],\"facets\":[]}" + "size": 2607, + "text": "{\"total\":5,\"p\":1,\"ps\":100,\"paging\":{\"pageIndex\":1,\"pageSize\":100,\"total\":5},\"effortTotal\":69,\"issues\":[{\"key\":\"03c7ec2c-2f9e-464d-b506-79f7c4dd47a3\",\"rule\":\"typescript:S3776\",\"severity\":\"CRITICAL\",\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"project\":\"test-project-2\",\"line\":53,\"hash\":\"09ad14e4ff4fb5e9bd2c589e2921607c\",\"textRange\":{\"startLine\":53,\"endLine\":53,\"startOffset\":16,\"endOffset\":32},\"flows\":[{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":64,\"endLine\":64,\"startOffset\":6,\"endOffset\":8},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":65,\"endLine\":65,\"startOffset\":43,\"endOffset\":45},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":67,\"endLine\":67,\"startOffset\":8,\"endOffset\":10},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":68,\"endLine\":68,\"startOffset\":10,\"endOffset\":12},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":71,\"endLine\":71,\"startOffset\":10,\"endOffset\":12},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":74,\"endLine\":74,\"startOffset\":10,\"endOffset\":12},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":80,\"endLine\":80,\"startOffset\":8,\"endOffset\":10},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":95,\"endLine\":95,\"startOffset\":10,\"endOffset\":14},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":82,\"endLine\":82,\"startOffset\":10,\"endOffset\":13},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":85,\"endLine\":85,\"startOffset\":14,\"endOffset\":19},\"msg\":\"+4 (incl. 3 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":99,\"endLine\":99,\"startOffset\":6,\"endOffset\":11},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":100,\"endLine\":100,\"startOffset\":6,\"endOffset\":8},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"textRange\":{\"startLine\":110,\"endLine\":110,\"startOffset\":8,\"endOffset\":12},\"msg\":\"+1\",\"msgFormattings\":[]}]}],\"status\":\"OPEN\",\"message\":\"Refactor this function to reduce its Cognitive Complexity from 27 to the 15 allowed.\",\"effort\":\"17min\",\"debt\":\"17min\",\"author\":\"bharat.kumavat@metronlabs.com\",\"tags\":[\"brain-overload\"],\"creationDate\":\"2024-06-27T05:29:54+0000\",\"updateDate\":\"2024-07-24T10:30:06+0000\",\"type\":\"CODE_SMELL\",\"scope\":\"MAIN\",\"quickFixAvailable\":false,\"messageFormattings\":[],\"codeVariants\":[],\"cleanCodeAttribute\":\"FOCUSED\",\"cleanCodeAttributeCategory\":\"ADAPTABLE\",\"impacts\":[{\"softwareQuality\":\"MAINTAINABILITY\",\"severity\":\"HIGH\"}],\"issueStatus\":\"OPEN\",\"prioritizedRule\":false},{\"key\":\"203e8170-ad29-4758-a769-78398582d441\",\"rule\":\"typescript:S3776\",\"severity\":\"CRITICAL\",\"component\":\"test-project-2:src/steps/resource-manager/container-services/client.ts\",\"project\":\"test-project-2\",\"line\":92,\"hash\":\"0559872e3277601b398ce77fef6b7f61\",\"textRange\":{\"startLine\":92,\"endLine\":92,\"startOffset\":15,\"endOffset\":33},\"flows\":[{\"locations\":[{\"component\":\"test-project-2:src/steps/resource-manager/container-services/client.ts\",\"textRange\":{\"startLine\":102,\"endLine\":102,\"startOffset\":4,\"endOffset\":6},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/resource-manager/container-services/client.ts\",\"textRange\":{\"startLine\":103,\"endLine\":103,\"startOffset\":4,\"endOffset\":7},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/resource-manager/container-services/client.ts\",\"textRange\":{\"startLine\":108,\"endLine\":108,\"startOffset\":8,\"endOffset\":11},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/resource-manager/container-services/client.ts\",\"textRange\":{\"startLine\":112,\"endLine\":112,\"startOffset\":8,\"endOffset\":11},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/resource-manager/container-services/client.ts\",\"textRange\":{\"startLine\":115,\"endLine\":115,\"startOffset\":8,\"endOffset\":13},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/resource-manager/container-services/client.ts\",\"textRange\":{\"startLine\":116,\"endLine\":116,\"startOffset\":8,\"endOffset\":10},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/resource-manager/container-services/client.ts\",\"textRange\":{\"startLine\":117,\"endLine\":117,\"startOffset\":10,\"endOffset\":12},\"msg\":\"+4 (incl. 3 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/resource-manager/container-services/client.ts\",\"textRange\":{\"startLine\":124,\"endLine\":124,\"startOffset\":10,\"endOffset\":12},\"msg\":\"+4 (incl. 3 for nesting)\",\"msgFormattings\":[]}]}],\"status\":\"OPEN\",\"message\":\"Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed.\",\"effort\":\"9min\",\"debt\":\"9min\",\"author\":\"gonzalo.avalos.ribas@contractor.jupiterone.com\",\"tags\":[\"brain-overload\"],\"creationDate\":\"2024-05-28T17:19:36+0000\",\"updateDate\":\"2024-07-24T10:30:06+0000\",\"type\":\"CODE_SMELL\",\"scope\":\"MAIN\",\"quickFixAvailable\":false,\"messageFormattings\":[],\"codeVariants\":[],\"cleanCodeAttribute\":\"FOCUSED\",\"cleanCodeAttributeCategory\":\"ADAPTABLE\",\"impacts\":[{\"softwareQuality\":\"MAINTAINABILITY\",\"severity\":\"HIGH\"}],\"issueStatus\":\"OPEN\",\"prioritizedRule\":false},{\"key\":\"0cb703a7-31cf-4288-9d71-908325233f23\",\"rule\":\"typescript:S3776\",\"severity\":\"CRITICAL\",\"component\":\"test-project-2:src/steps/active-directory/access-groups/index.ts\",\"project\":\"test-project-2\",\"line\":371,\"hash\":\"5671d2acfebdf56864db94c2d129c84b\",\"textRange\":{\"startLine\":371,\"endLine\":371,\"startOffset\":26,\"endOffset\":28},\"flows\":[{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/index.ts\",\"textRange\":{\"startLine\":375,\"endLine\":375,\"startOffset\":6,\"endOffset\":9},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/index.ts\",\"textRange\":{\"startLine\":377,\"endLine\":377,\"startOffset\":37,\"endOffset\":38},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/index.ts\",\"textRange\":{\"startLine\":378,\"endLine\":378,\"startOffset\":8,\"endOffset\":11},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/index.ts\",\"textRange\":{\"startLine\":381,\"endLine\":381,\"startOffset\":10,\"endOffset\":12},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/index.ts\",\"textRange\":{\"startLine\":381,\"endLine\":381,\"startOffset\":29,\"endOffset\":31},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/index.ts\",\"textRange\":{\"startLine\":382,\"endLine\":382,\"startOffset\":12,\"endOffset\":14},\"msg\":\"+4 (incl. 3 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/index.ts\",\"textRange\":{\"startLine\":383,\"endLine\":383,\"startOffset\":14,\"endOffset\":16},\"msg\":\"+5 (incl. 4 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/index.ts\",\"textRange\":{\"startLine\":384,\"endLine\":384,\"startOffset\":48,\"endOffset\":50},\"msg\":\"+1\",\"msgFormattings\":[]}]}],\"status\":\"OPEN\",\"message\":\"Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed.\",\"effort\":\"9min\",\"debt\":\"9min\",\"author\":\"gonzalo.avalos.ribas@contractor.jupiterone.com\",\"tags\":[\"brain-overload\"],\"creationDate\":\"2024-05-28T13:57:11+0000\",\"updateDate\":\"2024-07-24T10:30:06+0000\",\"type\":\"CODE_SMELL\",\"scope\":\"MAIN\",\"quickFixAvailable\":false,\"messageFormattings\":[],\"codeVariants\":[],\"cleanCodeAttribute\":\"FOCUSED\",\"cleanCodeAttributeCategory\":\"ADAPTABLE\",\"impacts\":[{\"softwareQuality\":\"MAINTAINABILITY\",\"severity\":\"HIGH\"}],\"issueStatus\":\"OPEN\",\"prioritizedRule\":false},{\"key\":\"81615f6e-a29f-4f19-9b66-e9acf2fc6e41\",\"rule\":\"typescript:S3776\",\"severity\":\"CRITICAL\",\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"project\":\"test-project-2\",\"line\":105,\"hash\":\"09ad14e4ff4fb5e9bd2c589e2921607c\",\"textRange\":{\"startLine\":105,\"endLine\":105,\"startOffset\":16,\"endOffset\":32},\"flows\":[{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":116,\"endLine\":116,\"startOffset\":6,\"endOffset\":8},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":117,\"endLine\":117,\"startOffset\":43,\"endOffset\":45},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":119,\"endLine\":119,\"startOffset\":8,\"endOffset\":10},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":120,\"endLine\":120,\"startOffset\":10,\"endOffset\":12},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":123,\"endLine\":123,\"startOffset\":10,\"endOffset\":12},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":126,\"endLine\":126,\"startOffset\":10,\"endOffset\":12},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":132,\"endLine\":132,\"startOffset\":8,\"endOffset\":10},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":147,\"endLine\":147,\"startOffset\":10,\"endOffset\":14},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":134,\"endLine\":134,\"startOffset\":10,\"endOffset\":13},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":137,\"endLine\":137,\"startOffset\":14,\"endOffset\":19},\"msg\":\"+4 (incl. 3 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":151,\"endLine\":151,\"startOffset\":6,\"endOffset\":11},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":152,\"endLine\":152,\"startOffset\":6,\"endOffset\":8},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":162,\"endLine\":162,\"startOffset\":8,\"endOffset\":12},\"msg\":\"+1\",\"msgFormattings\":[]}]}],\"status\":\"OPEN\",\"message\":\"Refactor this function to reduce its Cognitive Complexity from 27 to the 15 allowed.\",\"effort\":\"17min\",\"debt\":\"17min\",\"author\":\"poornima@metronlabs.com\",\"tags\":[\"brain-overload\"],\"creationDate\":\"2024-05-15T11:20:04+0000\",\"updateDate\":\"2024-07-24T10:30:06+0000\",\"type\":\"CODE_SMELL\",\"scope\":\"MAIN\",\"quickFixAvailable\":false,\"messageFormattings\":[],\"codeVariants\":[],\"cleanCodeAttribute\":\"FOCUSED\",\"cleanCodeAttributeCategory\":\"ADAPTABLE\",\"impacts\":[{\"softwareQuality\":\"MAINTAINABILITY\",\"severity\":\"HIGH\"}],\"issueStatus\":\"OPEN\",\"prioritizedRule\":false},{\"key\":\"4977b472-8701-4bf5-8658-5ebeb4c97bd9\",\"rule\":\"typescript:S3776\",\"severity\":\"CRITICAL\",\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"project\":\"test-project-2\",\"line\":168,\"hash\":\"0ce1bb87eb21989dae8edd8d5f622c0e\",\"textRange\":{\"startLine\":168,\"endLine\":168,\"startOffset\":16,\"endOffset\":43},\"flows\":[{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":179,\"endLine\":179,\"startOffset\":6,\"endOffset\":8},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":180,\"endLine\":180,\"startOffset\":43,\"endOffset\":45},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":182,\"endLine\":182,\"startOffset\":8,\"endOffset\":10},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":183,\"endLine\":183,\"startOffset\":10,\"endOffset\":12},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":186,\"endLine\":186,\"startOffset\":10,\"endOffset\":12},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":189,\"endLine\":189,\"startOffset\":10,\"endOffset\":12},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":195,\"endLine\":195,\"startOffset\":8,\"endOffset\":10},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":210,\"endLine\":210,\"startOffset\":10,\"endOffset\":14},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":197,\"endLine\":197,\"startOffset\":10,\"endOffset\":13},\"msg\":\"+3 (incl. 2 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":200,\"endLine\":200,\"startOffset\":14,\"endOffset\":19},\"msg\":\"+4 (incl. 3 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":214,\"endLine\":214,\"startOffset\":6,\"endOffset\":11},\"msg\":\"+1\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":215,\"endLine\":215,\"startOffset\":6,\"endOffset\":8},\"msg\":\"+2 (incl. 1 for nesting)\",\"msgFormattings\":[]}]},{\"locations\":[{\"component\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"textRange\":{\"startLine\":225,\"endLine\":225,\"startOffset\":8,\"endOffset\":12},\"msg\":\"+1\",\"msgFormattings\":[]}]}],\"status\":\"OPEN\",\"message\":\"Refactor this function to reduce its Cognitive Complexity from 27 to the 15 allowed.\",\"effort\":\"17min\",\"debt\":\"17min\",\"author\":\"poornima@metronlabs.com\",\"tags\":[\"brain-overload\"],\"creationDate\":\"2024-05-15T11:20:04+0000\",\"updateDate\":\"2024-07-24T10:30:06+0000\",\"type\":\"CODE_SMELL\",\"scope\":\"MAIN\",\"quickFixAvailable\":false,\"messageFormattings\":[],\"codeVariants\":[],\"cleanCodeAttribute\":\"FOCUSED\",\"cleanCodeAttributeCategory\":\"ADAPTABLE\",\"impacts\":[{\"softwareQuality\":\"MAINTAINABILITY\",\"severity\":\"HIGH\"}],\"issueStatus\":\"OPEN\",\"prioritizedRule\":false}],\"components\":[{\"key\":\"test-project-2\",\"enabled\":true,\"qualifier\":\"TRK\",\"name\":\"test-project-2\",\"longName\":\"test-project-2\"},{\"key\":\"test-project-2:src/steps/active-directory/access-groups/client.ts\",\"enabled\":true,\"qualifier\":\"FIL\",\"name\":\"client.ts\",\"longName\":\"src/steps/active-directory/access-groups/client.ts\",\"path\":\"src/steps/active-directory/access-groups/client.ts\"},{\"key\":\"test-project-2:src/steps/active-directory/conditional-access-policy/client.ts\",\"enabled\":true,\"qualifier\":\"FIL\",\"name\":\"client.ts\",\"longName\":\"src/steps/active-directory/conditional-access-policy/client.ts\",\"path\":\"src/steps/active-directory/conditional-access-policy/client.ts\"},{\"key\":\"test-project-2:src/steps/active-directory/access-groups/index.ts\",\"enabled\":true,\"qualifier\":\"FIL\",\"name\":\"index.ts\",\"longName\":\"src/steps/active-directory/access-groups/index.ts\",\"path\":\"src/steps/active-directory/access-groups/index.ts\"},{\"key\":\"test-project-2:src/steps/resource-manager/container-services/client.ts\",\"enabled\":true,\"qualifier\":\"FIL\",\"name\":\"client.ts\",\"longName\":\"src/steps/resource-manager/container-services/client.ts\",\"path\":\"src/steps/resource-manager/container-services/client.ts\"}],\"facets\":[]}" }, "cookies": [], "headers": [ @@ -1034,7 +994,7 @@ }, { "name": "date", - "value": "Wed, 24 Jul 2024 15:03:02 GMT" + "value": "Fri, 02 Aug 2024 06:58:25 GMT" }, { "name": "connection", @@ -1047,8 +1007,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2024-07-24T15:03:02.528Z", - "time": 19, + "startedDateTime": "2024-08-02T06:58:25.152Z", + "time": 51, "timings": { "blocked": -1, "connect": -1, @@ -1056,11 +1016,11 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 19 + "wait": 51 } }, { - "_id": "fc74d49b3de5ad9ca3078ae620c8a613", + "_id": "13f57e0e8fbc996b144a9e6820f6b576", "_order": 0, "cache": {}, "request": { @@ -1092,7 +1052,7 @@ "value": "localhost:9000" } ], - "headersSize": 392, + "headersSize": 353, "httpVersion": "HTTP/1.1", "method": "GET", "queryString": [ @@ -1108,31 +1068,23 @@ "name": "componentKeys", "value": "test-project-2" }, - { - "name": "issueStatuses", - "value": "" - }, - { - "name": "impactSoftwareQualities", - "value": "" - }, { "name": "createdInLast", - "value": "1m" + "value": "90d" }, { "name": "impactSeverities", "value": "HIGH" } ], - "url": "http://localhost:9000/api/issues/search?p=2&ps=100&componentKeys=test-project-2&issueStatuses=&impactSoftwareQualities=&createdInLast=1m&impactSeverities=HIGH" + "url": "http://localhost:9000/api/issues/search?p=2&ps=100&componentKeys=test-project-2&createdInLast=90d&impactSeverities=HIGH" }, "response": { - "bodySize": 178, + "bodySize": 182, "content": { "mimeType": "application/json", - "size": 178, - "text": "{\"total\":1,\"p\":2,\"ps\":100,\"paging\":{\"pageIndex\":2,\"pageSize\":100,\"total\":1},\"effortTotal\":17,\"issues\":[],\"components\":[],\"facets\":[]}" + "size": 182, + "text": "{\"total\":5,\"p\":2,\"ps\":100,\"paging\":{\"pageIndex\":2,\"pageSize\":100,\"total\":5},\"effortTotal\":69,\"issues\":[],\"components\":[],\"facets\":[]}" }, "cookies": [], "headers": [ @@ -1190,7 +1142,7 @@ }, { "name": "date", - "value": "Wed, 24 Jul 2024 15:03:02 GMT" + "value": "Fri, 02 Aug 2024 06:58:25 GMT" }, { "name": "connection", @@ -1203,8 +1155,8 @@ "status": 200, "statusText": "OK" }, - "startedDateTime": "2024-07-24T15:03:02.551Z", - "time": 10, + "startedDateTime": "2024-08-02T06:58:25.210Z", + "time": 25, "timings": { "blocked": -1, "connect": -1, @@ -1212,7 +1164,7 @@ "receive": 0, "send": 0, "ssl": -1, - "wait": 10 + "wait": 25 } } ], diff --git a/src/steps/finding/index.ts b/src/steps/finding/index.ts index e2920ea..bc7a0ee 100644 --- a/src/steps/finding/index.ts +++ b/src/steps/finding/index.ts @@ -7,11 +7,8 @@ import { } from '@jupiterone/integration-sdk-core'; import { - DEFAULT_CREATED_IN_LAST, + DEFAULT_FINDING_INGEST_SINCE_DAYS, Entities, - FINDING_STATUSES, - FINDING_TYPES, - FINDINGS_SEVERITIES, INGESTION_SOURCE_IDS, Relationships, Steps, @@ -28,47 +25,28 @@ import { import { APIVersion } from '../../provider/types/common'; import { createProjectEntityIdentifier } from '../project/converter'; -function getSeverities(instanceConfig: SonarqubeIntegrationConfig) { - const { severities, apiVersion } = instanceConfig; - const severitiesSet = new Set( - severities?.split(',').map((severity) => FINDINGS_SEVERITIES[severity]), - ); - - // V2 -> 10.4 or above version - if (apiVersion == APIVersion.V1) { - return severities ? severities.split(',') : V1_SEVERITIES_VALUES; - } - return severitiesSet.size === 0 - ? V2_SEVERITIES_VALUES - : Array.from(severitiesSet); -} - function getFilterParams( instanceConfig: SonarqubeIntegrationConfig, ): NodeJS.Dict { - const { apiVersion, status, createdInLast, types } = instanceConfig; - - let filterParams: NodeJS.Dict; - - if (apiVersion === APIVersion.V1) { - // V1 -> below 10.4 version - filterParams = { - status, - types, - }; - } else { - const statusesSet = new Set( - status?.split(',').map((status) => FINDING_STATUSES[status]), - ); - const typesSet = new Set( - types?.split(',').map((type) => FINDING_TYPES[type]), - ); - filterParams = { - issueStatuses: Array.from(statusesSet).join(','), - impactSoftwareQualities: Array.from(typesSet).join(','), - }; + const { apiVersion, findingStatus, findingsIngestSinceDays, findingTypes } = + instanceConfig; + + const filterParams: NodeJS.Dict = {}; + + const statusKey = apiVersion === APIVersion.V1 ? 'status' : 'issueStatuses'; + const typesKey = + apiVersion === APIVersion.V1 ? 'types' : 'impactSoftwareQualities'; + + if (findingStatus) { + filterParams[statusKey] = findingStatus; + } + if (findingTypes) { + filterParams[typesKey] = findingTypes; } - filterParams['createdInLast'] = createdInLast || DEFAULT_CREATED_IN_LAST; + + filterParams['createdInLast'] = + `${findingsIngestSinceDays || DEFAULT_FINDING_INGEST_SINCE_DAYS}d`; + return filterParams; } @@ -79,7 +57,12 @@ export async function fetchFindings({ }: IntegrationStepExecutionContext) { const client = createSonarqubeClient(instance.config, logger); - const severities = getSeverities(instance.config); + const severityList = instance.config.findingSeverities + ? instance.config.findingSeverities + : instance.config.apiVersion === APIVersion.V1 + ? V1_SEVERITIES_VALUES + : V2_SEVERITIES_VALUES; + const filterParams = getFilterParams(instance.config); await jobState.iterateEntities( @@ -95,7 +78,7 @@ export async function fetchFindings({ // We need to further filter our API calls in order to minimize the chances // we'll hit the 10,000 limit impose by the API. We're currently filtering // by project and severity. - for (const severity of severities) { + for (const severity of severityList) { if (instance.config.apiVersion == APIVersion.V1) { filterParams['severities'] = severity; } else { diff --git a/src/types.ts b/src/types.ts index 971a9a7..ac7a9e5 100644 --- a/src/types.ts +++ b/src/types.ts @@ -14,8 +14,8 @@ export interface SonarqubeIntegrationConfig extends IntegrationInstanceConfig { * where the parameter {@param endpointVersion} determines the url to query */ apiVersion: APIVersion; - severities?: string; - status?: string; - createdInLast?: string; - types?: string; + findingSeverities?: string[]; + findingStatus?: string[]; + findingsIngestSinceDays?: number; + findingTypes?: string[]; } diff --git a/src/validateInvocation.test.ts b/src/validateInvocation.test.ts index a3506e4..0c55827 100644 --- a/src/validateInvocation.test.ts +++ b/src/validateInvocation.test.ts @@ -31,11 +31,10 @@ describe('#validateInvocation', () => { }, }); - const executionContext = createMockExecutionContext< - SonarqubeIntegrationConfig - >({ - instanceConfig: {} as SonarqubeIntegrationConfig, - }); + const executionContext = + createMockExecutionContext({ + instanceConfig: {} as SonarqubeIntegrationConfig, + }); await expect(validateInvocation(executionContext)).rejects.toThrowError( IntegrationValidationError, @@ -57,15 +56,14 @@ describe('#validateInvocation', () => { mutateEntry: mutations.unzipGzippedRecordingEntry, }); - const executionContext = createMockExecutionContext< - SonarqubeIntegrationConfig - >({ - instanceConfig: { - baseUrl: process.env.BASE_URL || 'http://localhost:9000', - apiToken: 'INVALID', - apiVersion: APIVersion.V1, - }, - }); + const executionContext = + createMockExecutionContext({ + instanceConfig: { + baseUrl: process.env.BASE_URL || 'http://localhost:9000', + apiToken: 'INVALID', + apiVersion: APIVersion.V1, + }, + }); await expect(validateInvocation(executionContext)).rejects.toThrowError( IntegrationValidationError, @@ -87,15 +85,14 @@ describe('#validateInvocation', () => { mutateEntry: mutations.unzipGzippedRecordingEntry, }); - const executionContext = createMockExecutionContext< - SonarqubeIntegrationConfig - >({ - instanceConfig: { - baseUrl: 'http://example.com', - apiToken: process.env.API_TOKEN || 'string-value', - apiVersion: APIVersion.V1, - }, - }); + const executionContext = + createMockExecutionContext({ + instanceConfig: { + baseUrl: 'http://example.com', + apiToken: process.env.API_TOKEN || 'string-value', + apiVersion: APIVersion.V1, + }, + }); await expect(validateInvocation(executionContext)).rejects.toThrowError( IntegrationValidationError, diff --git a/src/validateInvocation.ts b/src/validateInvocation.ts index 9be6f58..3cad121 100644 --- a/src/validateInvocation.ts +++ b/src/validateInvocation.ts @@ -7,6 +7,11 @@ import { createSonarqubeClient } from './provider/index'; import { SonarqubeIntegrationConfig } from './types'; import { SonarqubeSystemInfo } from './provider/types/v1'; import { APIVersion } from './provider/types/common'; +import { + FINDING_STATUSES, + FINDING_TYPES, + FINDINGS_SEVERITIES, +} from './steps/constants'; function getApiVersion(systemInfo: SonarqubeSystemInfo): APIVersion { const INITIAL_SONARQUBE_WITH_API_V2 = '10.4'; @@ -16,6 +21,24 @@ function getApiVersion(systemInfo: SonarqubeSystemInfo): APIVersion { return shouldUseV1 ? APIVersion.V1 : APIVersion.V2; } +function validSeverities(severities: string[]) { + return severities.every((severity) => + ['INFO', 'MINOR', 'MAJOR', 'CRITICAL', 'BLOCKER'].includes(severity), + ); +} + +function validStatuses(statuses: string[]) { + return statuses.every((status) => + ['OPEN', 'CONFIRMED', 'REOPENED', 'RESOLVED', 'CLOSED'].includes(status), + ); +} + +function validTypes(types: string[]) { + return types.every((type) => + ['CODE_SMELL', 'BUG', 'VULNERABILITY'].includes(type), + ); +} + export default async function validateInvocation({ instance, logger, @@ -32,6 +55,70 @@ export default async function validateInvocation({ config.baseUrl = config.baseUrl.slice(0, -1); } + if (config.findingSeverities) { + const findingSeverities = (config.findingSeverities as unknown as string) + .split(',') + .map((s) => s.trim()); + if (!validSeverities(findingSeverities)) { + throw new IntegrationValidationError( + 'Invalid Finding severities. Valid severities are INFO, MINOR, MAJOR, CRITICAL, BLOCKER', + ); + } + + if (config.apiVersion == APIVersion.V1) { + config.findingSeverities = findingSeverities; + } else { + const findingSeveritiesSet = new Set( + config.findingSeverities.map( + (findingSeverity) => FINDINGS_SEVERITIES[findingSeverity], + ), + ); + config.findingSeverities = Array.from(findingSeveritiesSet); + } + } + + if (config.findingStatus) { + const findingStatus = (config.findingStatus as unknown as string) + .split(',') + .map((s) => s.trim()); + if (!validStatuses(findingStatus)) { + throw new IntegrationValidationError( + 'Invalid Finding Status. Valid severities are OPEN, CONFIRMED, REOPENED, RESOLVED, CLOSED', + ); + } + + if (config.apiVersion == APIVersion.V1) { + config.findingSeverities = findingStatus; + } else { + const findingStatusSet = new Set( + config.findingStatus.map( + (findingStatus) => FINDING_STATUSES[findingStatus], + ), + ); + config.findingStatus = Array.from(findingStatusSet); + } + } + + if (config.findingTypes) { + const findingTypes = (config.findingTypes as unknown as string) + .split(',') + .map((s) => s.trim()); + if (!validTypes(findingTypes)) { + throw new IntegrationValidationError( + 'Invalid vulnerability severities. Valid severities are CODE_SMELL,BUG,VULNERABILITY', + ); + } + + if (config.apiVersion == APIVersion.V1) { + config.findingTypes = findingTypes; + } else { + const findingStatusSet = new Set( + config.findingTypes.map((findingType) => FINDING_TYPES[findingType]), + ); + config.findingTypes = Array.from(findingStatusSet); + } + } + const client = createSonarqubeClient(instance.config, logger); try { const systemInfo = await client.fetchSystemInfo(); diff --git a/test/config.ts b/test/config.ts index 2f52044..ac79948 100644 --- a/test/config.ts +++ b/test/config.ts @@ -15,7 +15,7 @@ if (process.env.LOAD_ENV) { const DEFAULT_API_TOKEN = 'dummy-sonarqube-api-token'; const DEFAULT_BASE_URL = 'http://127.0.0.1:9000'; const DEFAULT_API_VERSION = APIVersion.V2; -const DEFAULT_CREATED_IN_LAST = '1m'; +const DEFAULT_CREATED_IN_LAST = 90; export function buildStepTestConfigForStep(stepId: string): StepTestConfig { const integrationConfig: SonarqubeIntegrationConfig = { @@ -23,7 +23,8 @@ export function buildStepTestConfigForStep(stepId: string): StepTestConfig { baseUrl: process.env.BASE_URL || DEFAULT_BASE_URL, // Using env var to determine version since we don't want to query the system info when running a test apiVersion: (process.env.API_VERSION as APIVersion) || DEFAULT_API_VERSION, - createdInLast: process.env.CREATED_IN_LAST || DEFAULT_CREATED_IN_LAST + findingsIngestSinceDays: + process.env.CREATED_IN_LAST ? + process.env.CREATED_IN_LAST : DEFAULT_CREATED_IN_LAST, }; return {