diff --git a/src/constants.ts b/src/constants.ts index 3379711..20c8135 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,6 +1,7 @@ export const EXT_COMMON_NAME = "PoiEx"; export const EXT_NAME = "poiex"; export const SEMGREP_TIMEOUT_MS = 240 * 1000; // Semgrep timeout to be used when scanning HCL files +export const SEMGREP_MAX_BUFFER = 1024 * 1024 * 20; // 20MB export const REMOTEDB_INIT_TIMEOUT_MS = 10 * 1000; export const RW_CHECK_COLLECTION = "readWriteCheckCollection"; export const PROJECT_DIR_COLLECTION = "projectDir"; diff --git a/src/semgrep.ts b/src/semgrep.ts index 6985ce8..8a51c1d 100644 --- a/src/semgrep.ts +++ b/src/semgrep.ts @@ -67,7 +67,7 @@ export async function runSemgrep(context: vscode.ExtensionContext, path: string, let execFile = util.promisify(child_process.execFile); try { - let {stderr, stdout} = await execFile(semgrepPath, semgrepArgsArray, { timeout: semgrepTimeout * 1000, cwd: path, maxBuffer: 1024 * 1024 * 2 }); + let {stderr, stdout} = await execFile(semgrepPath, semgrepArgsArray, { timeout: semgrepTimeout * 1000, cwd: path, maxBuffer: constants.SEMGREP_MAX_BUFFER }); if (stderr) { console.log(`[IaC Semgrep] stderr: ${stderr}`); vscode.window.showErrorMessage(`Semgrep error: ${stderr}`); @@ -109,7 +109,7 @@ export async function runSemgrepHcl(context: vscode.ExtensionContext, wspath: st let execFile = util.promisify(child_process.execFile); try { - let {stderr, stdout} = await execFile(semgrepPath, semgrepArgsArray, { timeout: SEMGREP_TIMEOUT_MS, cwd: wspath, maxBuffer: 1024 * 1024 * 2 }); + let {stderr, stdout} = await execFile(semgrepPath, semgrepArgsArray, { timeout: SEMGREP_TIMEOUT_MS, cwd: wspath, maxBuffer: constants.SEMGREP_MAX_BUFFER }); if (stderr) { console.log(`[IaC Semgrep] stderr: ${stderr}`); vscode.window.showErrorMessage(`Semgrep error: ${stderr}`);