diff --git a/src/cydigConfig.json b/src/cydigConfig.json index 19ace9e7..da1ca6e9 100644 --- a/src/cydigConfig.json +++ b/src/cydigConfig.json @@ -1,46 +1,29 @@ { - "teamName": "Test-GitHub", + "teamName": "CyDig", "usingAzure": true, "threatModeling": { - "date": "2023-09-07", - "boardsTag": "TM" + "date": "2024-01-01", + "boardsTag": "TM" }, "pentest": { - "date": "2023-09-07", - "boardsTag": "PT" - }, - "github": { - "usingRepos": true + "date": "2023-01-01", + "boardsTag": "PT" }, "azureDevOps": { - "usingRepos": false, - "repos": { - "username": "firstname.lastname (usually)" - }, - "usingBoards": true, - "boards": { - "nameOfBoard": "not specified" - }, - "organizationName": "CyDig", - "projectName": "CyDig" + "usingBoards": true, + "boards": { + "organizationName": "CyDig", + "projectName": "CyDig", + "nameOfBoard": "not specified" + } }, "scaTool": { - "nameOfTool": "name-of-tool", - "owaspDependencyCheck": { - "reportPath": "Reports/dependency-check-report.csv", - "csvPath": "not specified" - } + "nameOfTool": "OWASP" }, "sastTool": { - "nameOfTool": "name-of-tool", - "semgrep": { - "reportPath": "semgrep-json.json" - } + "nameOfTool": "CodeQL" }, "codeQualityTool": { - "nameOfTool": "name-of-tool" - }, - "reposToExclude": { - "nameOfRepos": "not-specified" + "nameOfTool": "not specified" } } diff --git a/src/lib/BodyBuilder.ts b/src/lib/BodyBuilder.ts index 4dc215f9..4c6c0c0a 100644 --- a/src/lib/BodyBuilder.ts +++ b/src/lib/BodyBuilder.ts @@ -38,7 +38,7 @@ export class BodyBuilder { const cqNumberOfSeverity5: string | undefined = process.env?.CQnumberOfSeverity5; const sastNumberOfSeverity1: string | undefined = process.env?.SASTnumberOfSeverity1; - const sastNumberOfSeverity2: string | undefined = process.env.SASTnumberOfSeverity2; + const sastNumberOfSeverity2: string | undefined = process.env?.SASTnumberOfSeverity2; const sastNumberOfSeverity3: string | undefined = process.env?.SASTnumberOfSeverity3; const tmNumberOfActiveTickets: string | undefined = process.env?.tmNumberOfActiveTickets @@ -47,9 +47,9 @@ export class BodyBuilder { const ptNumberOfActiveTickets: string | undefined = process.env?.ptNumberOfActiveTickets; const ptNumberOfClosedTickets: string | undefined = process.env?.ptNumberOfClosedTickets; - const numUserInProdSeverity1: string | undefined = process.env.numUserInProdSeverity1; - const numUserInProdSeverity2: string | undefined = process.env.numUserInProdSeverity2; - const numUserInProdSeverity3: string | undefined = process.env.numUserInProdSeverity3; + const numUserInProdSeverity1: string | undefined = process.env?.numUserInProdSeverity1; + const numUserInProdSeverity2: string | undefined = process.env?.numUserInProdSeverity2; + const numUserInProdSeverity3: string | undefined = process.env?.numUserInProdSeverity3; //For printing urls in the pipeline const urlBody: UrlBody = new UrlBodyBuilder() diff --git a/src/lib/JsonService.ts b/src/lib/JsonService.ts index 6da5490e..0753f794 100644 --- a/src/lib/JsonService.ts +++ b/src/lib/JsonService.ts @@ -1,7 +1,6 @@ import * as fs from 'fs'; import * as path from 'path'; import { CyDigConfig } from './types/CyDigConfig'; -import Joi from 'joi'; export function getContentOfFile(jsonPath: string): CyDigConfig { const jsonFilePath: string = path.resolve( @@ -11,60 +10,5 @@ export function getContentOfFile(jsonPath: string): CyDigConfig { const fileContent: string = fs.readFileSync(jsonFilePath, { encoding: 'utf-8' }); const cydigConfig: CyDigConfig = JSON.parse(fileContent); - validateConfig(cydigConfig); - return cydigConfig; } - -export function validateConfig(config: unknown): void { - const schema: Joi.ObjectSchema = Joi.object({ - teamName: Joi.string().required(), - usingAzure: Joi.boolean(), - threatModeling: Joi.object({ - date: Joi.string(), - boardsTag: Joi.string(), - }), - pentest: Joi.object({ - date: Joi.string(), - boardsTag: Joi.string(), - }), - github: Joi.object({ - usingRepos: Joi.boolean(), - }), - azureDevOps: { - usingRepos: Joi.boolean(), - repos: Joi.object({ - username: Joi.string(), - }), - usingBoards: Joi.boolean(), - boards: Joi.object({ - nameOfBoard: Joi.string(), - }), - organizationName: Joi.string(), - projectName: Joi.string(), - }, - scaTool: Joi.object({ - nameOfTool: Joi.string(), - owaspDependencyCheck: Joi.object({ - reportPath: Joi.string(), - csvPath: Joi.string().optional(), - }), - }), - sastTool: Joi.object({ - nameOfTool: Joi.string(), - semgrep: Joi.object({ - reportPath: Joi.string(), - }), - }), - codeQualityTool: Joi.object({ - nameOfTool: Joi.string(), - }), - reposToExclude: Joi.object({ - nameOfRepos: Joi.string().optional(), - }), - }); - - if (schema.validate(config).error) { - throw new Error(`${schema.validate(config).error?.message} in your CyDig Config file`); - } -} diff --git a/src/lib/types/CyDigConfig.ts b/src/lib/types/CyDigConfig.ts index 174d3083..d10c8451 100644 --- a/src/lib/types/CyDigConfig.ts +++ b/src/lib/types/CyDigConfig.ts @@ -9,29 +9,21 @@ export type CyDigConfig = { date: string; boardsTag: string; }; - github: { - usingRepos: boolean; - repos: { - username: string; - }; + azureDevOps: { usingBoards: boolean; boards: { + organizationName: string; + projectName: string; nameOfBoard: string; }; }; scaTool: { nameOfTool: string; - owaspDependencyCheck: { - reportPath: string; - }; - }; + }, sastTool: { nameOfTool: string; - semgrep: { - reportPath: string; - }; - }; + }, codeQualityTool: { nameOfTool: string; - }; + } };