Skip to content

Commit 514a362

Browse files
committed
Wait for DAST results when checking the scan status
1 parent 32a53f9 commit 514a362

2 files changed

Lines changed: 7 additions & 11 deletions

File tree

main.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ function check_severity_findings(dt_results_api_key, mobile_app_id, results_sinc
8989
});
9090
}
9191
function run() {
92-
var _a;
9392
return __awaiter(this, void 0, void 0, function* () {
9493
// Get inputs
9594
// Mandatory
@@ -292,15 +291,14 @@ function run() {
292291
continue;
293292
}
294293
const status_data = yield status_response.json();
295-
const scan_status = ((_a = status_data.static_scan) === null || _a === void 0 ? void 0 : _a.status) || status_data.status;
294+
const scan_status = status_data.status;
296295
if (scan_status &&
297296
["FAILED", "SCAN_ATTEMPT_ERROR", "CANCELLED"].includes(scan_status)) {
298297
console.log(`Scan ${scan_id} failed, skipping vulnerability check`);
299298
break;
300299
}
301-
if (!status_data.static_scan ||
302-
status_data.static_scan.status !== "COMPLETED") {
303-
console.log(`Scan ${scan_id} still in progress, waiting...`);
300+
if (scan_status !== "COMPLETED") {
301+
console.log(`Scan ${scan_id} still in progress (current status: ${scan_status}), waiting...`);
304302
yield new Promise((resolve) => setTimeout(resolve, pollInterval));
305303
continue;
306304
}

main.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,8 @@ async function run() {
363363
}
364364

365365
const status_data = await status_response.json();
366-
const scan_status = status_data.static_scan?.status || status_data.status;
366+
const scan_status = status_data.status;
367+
367368
if (
368369
scan_status &&
369370
["FAILED", "SCAN_ATTEMPT_ERROR", "CANCELLED"].includes(scan_status)
@@ -372,11 +373,8 @@ async function run() {
372373
break;
373374
}
374375

375-
if (
376-
!status_data.static_scan ||
377-
status_data.static_scan.status !== "COMPLETED"
378-
) {
379-
console.log(`Scan ${scan_id} still in progress, waiting...`);
376+
if (scan_status !== "COMPLETED") {
377+
console.log(`Scan ${scan_id} still in progress (current status: ${scan_status}), waiting...`);
380378
await new Promise((resolve) => setTimeout(resolve, pollInterval));
381379
continue;
382380
}

0 commit comments

Comments
 (0)