From 0e4ea5e4a38aa9f3a9514e9711b293e772b181bd Mon Sep 17 00:00:00 2001 From: Kevin Barnoin Date: Fri, 31 May 2024 15:50:04 +0200 Subject: [PATCH] fix: allow manual job execution on pentest (#1282) --- server/src/commands.ts | 1 + server/src/jobs/jobs_actions.ts | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/src/commands.ts b/server/src/commands.ts index e652f7a66c..ad23bd6e97 100644 --- a/server/src/commands.ts +++ b/server/src/commands.ts @@ -151,6 +151,7 @@ function createJobAction(name) { name, queued, payload, + disallowPentest: false, }) if (exitCode) { diff --git a/server/src/jobs/jobs_actions.ts b/server/src/jobs/jobs_actions.ts index c532c95774..309c6ed733 100644 --- a/server/src/jobs/jobs_actions.ts +++ b/server/src/jobs/jobs_actions.ts @@ -15,15 +15,16 @@ import { runJob } from "./jobs" const logger = getLoggerWithContext("script") -type AddJobSimpleParams = Pick & Partial> & { queued?: boolean; productionOnly?: boolean } +type AddJobSimpleParams = Pick & + Partial> & { queued?: boolean; productionOnly?: boolean; disallowPentest?: boolean } -export async function addJob({ name, payload, scheduled_for = new Date(), queued = false, productionOnly = false }: AddJobSimpleParams): Promise { +export async function addJob({ name, payload, scheduled_for = new Date(), queued = false, productionOnly = false, disallowPentest = true }: AddJobSimpleParams): Promise { if (config.env !== "production" && productionOnly) { return 0 } // disable all jobs on pentest env - if (config.env === "pentest") { + if (config.env === "pentest" && disallowPentest) { return 0 }