Skip to content

Commit

Permalink
Increase Semgrep stdout buffer to 20MB
Browse files Browse the repository at this point in the history
  • Loading branch information
michelelizzit committed Dec 4, 2023
1 parent b7df90d commit 589db9b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
4 changes: 2 additions & 2 deletions src/semgrep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down Expand Up @@ -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}`);
Expand Down

0 comments on commit 589db9b

Please sign in to comment.