in packages/web-api/src/controllers/scan-request-controller.ts [160:186]
private validateRunRequest(scanRunRequest: ScanRunRequest): RunRequestValidationResult {
if (Url.tryParseUrlString(scanRunRequest.url) === undefined) {
return { valid: false, error: WebApiErrorCodes.invalidURL.error };
}
if (!isEmpty(scanRunRequest.scanNotifyUrl) && Url.tryParseUrlString(scanRunRequest.scanNotifyUrl) === undefined) {
return { valid: false, error: WebApiErrorCodes.invalidScanNotifyUrl.error };
}
if (scanRunRequest.priority < this.config.minScanPriorityValue || scanRunRequest.priority > this.config.maxScanPriorityValue) {
return { valid: false, error: WebApiErrorCodes.outOfRangePriority.error };
}
const emptyBaseUrl = isEmpty(scanRunRequest.site?.baseUrl);
const emptyReportGroup =
isEmpty(scanRunRequest.reportGroups) || scanRunRequest.reportGroups.some((g) => isEmpty(g?.consolidatedId));
if (scanRunRequest.deepScan && (emptyBaseUrl || emptyReportGroup)) {
return { valid: false, error: WebApiErrorCodes.missingRequiredDeepScanProperties.error };
}
if (emptyBaseUrl !== emptyReportGroup) {
return { valid: false, error: WebApiErrorCodes.missingSiteOrReportGroups.error };
}
return { valid: true };
}