Skip to content

Commit

Permalink
fix: allow manual job execution on pentest (#1282)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevbarns authored May 31, 2024
1 parent e340a09 commit 0e4ea5e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions server/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ function createJobAction(name) {
name,
queued,
payload,
disallowPentest: false,
})

if (exitCode) {
Expand Down
7 changes: 4 additions & 3 deletions server/src/jobs/jobs_actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ import { runJob } from "./jobs"

const logger = getLoggerWithContext("script")

type AddJobSimpleParams = Pick<IInternalJobsSimple, "name" | "payload"> & Partial<Pick<IInternalJobsSimple, "scheduled_for">> & { queued?: boolean; productionOnly?: boolean }
type AddJobSimpleParams = Pick<IInternalJobsSimple, "name" | "payload"> &
Partial<Pick<IInternalJobsSimple, "scheduled_for">> & { queued?: boolean; productionOnly?: boolean; disallowPentest?: boolean }

export async function addJob({ name, payload, scheduled_for = new Date(), queued = false, productionOnly = false }: AddJobSimpleParams): Promise<number> {
export async function addJob({ name, payload, scheduled_for = new Date(), queued = false, productionOnly = false, disallowPentest = true }: AddJobSimpleParams): Promise<number> {
if (config.env !== "production" && productionOnly) {
return 0
}

// disable all jobs on pentest env
if (config.env === "pentest") {
if (config.env === "pentest" && disallowPentest) {
return 0
}

Expand Down

0 comments on commit 0e4ea5e

Please sign in to comment.