Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public static FoDScanAssessmentTypeDescriptor getEntitlementToUse(UnirestInstanc
Integer assessmentTypeId = 0;
LOG.info("Finding/Validating entitlement to use.");

var atd = FoDReleaseAssessmentTypeHelper.getAssessmentTypeDescriptor(unirest, relId, scanType,
var atd = FoDReleaseAssessmentTypeHelper.getAssessmentTypeDescriptor(unirest, relId, scanType,
entitlementFrequencyType, assessmentType);
assessmentTypeId = atd.getAssessmentTypeId();
entitlementIdToUse = atd.getEntitlementId();
Expand Down Expand Up @@ -191,7 +191,7 @@ private static final FoDScanDescriptor getDescriptor(JsonNode node) {
return JsonHelper.treeToValue(node, FoDScanDescriptor.class);
}

private static final FoDScanDescriptor getEmptyDescriptor() {
public static final FoDScanDescriptor getEmptyDescriptor() {
return JsonHelper.treeToValue(getObjectMapper().createObjectNode(), FoDScanDescriptor.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import com.fortify.cli.fod._common.scan.cli.cmd.AbstractFoDScanStartCommand;
import com.fortify.cli.fod._common.scan.cli.mixin.FoDInProgressScanActionTypeMixins;
import com.fortify.cli.fod._common.scan.helper.FoDScanDescriptor;
import com.fortify.cli.fod._common.scan.helper.FoDScanHelper;
import com.fortify.cli.fod._common.scan.helper.FoDScanType;
import com.fortify.cli.fod._common.scan.helper.dast.FoDScanDastAutomatedHelper;
import com.fortify.cli.fod._common.util.FoDEnums;
import com.fortify.cli.fod.release.helper.FoDReleaseDescriptor;
Expand Down Expand Up @@ -50,15 +52,21 @@ protected FoDScanDescriptor startScan(UnirestInstance unirest, FoDReleaseDescrip
// get current setup to ensure the scan has been configured
FoDScanDastAutomatedHelper.getSetupDescriptor(unirest, relId);

// check if scan is already in progress
FoDScanDescriptor scan = FoDScanDastAutomatedHelper.handleInProgressScan(unirest, releaseDescriptor,
inProgressScanActionType.getInProgressScanActionType(), progressWriter, maxAttempts,
waitInterval);
// check if there have been any scans previously run for this release
if (!FoDScanDastAutomatedHelper.getLatestScanDescriptor(unirest, relId, FoDScanType.Dynamic, true)
.equals(FoDScanHelper.getEmptyDescriptor())) {

if (scan != null && scan.getAnalysisStatusType().equals("In_Progress")) {
if (inProgressScanActionType.getInProgressScanActionType() == FoDEnums.InProgressScanActionType.DoNotStartScan) {
scanAction = "NOT_STARTED_SCAN_IN_PROGRESS";
return scan;
// if there is an in progress scan, handle according to the specified action type
FoDScanDescriptor scan = FoDScanDastAutomatedHelper.handleInProgressScan(unirest, releaseDescriptor,
inProgressScanActionType.getInProgressScanActionType(), progressWriter, maxAttempts,
waitInterval);

// if the action was to not start a new scan, return the in progress scan descriptor
if (scan != null && scan.getAnalysisStatusType().equals("In_Progress")) {
if (inProgressScanActionType.getInProgressScanActionType() == FoDEnums.InProgressScanActionType.DoNotStartScan) {
scanAction = "NOT_STARTED_SCAN_IN_PROGRESS";
return scan;
}
}
}
Comment on lines +55 to 71
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new guard uses FoDScanDastAutomatedHelper.getLatestScanDescriptor(...Dynamic...) to decide whether to call handleInProgressScan(), but getLatestScanDescriptor() filters out analysisStatusType=In_Progress. If a release only has an active/in-progress scan (e.g., the very first scan is currently running), this condition will evaluate as “no previous scans”, skip the in-progress handling entirely, and then attempt to start a new scan.

A more reliable fix is to handle the “no scans exist yet” case inside handleInProgressScan() (return null immediately when the scan list is empty) or change this check to detect whether the release scan list is empty without excluding active scans.

Copilot uses AI. Check for mistakes.

Expand All @@ -70,4 +78,5 @@ protected FoDScanDescriptor startScan(UnirestInstance unirest, FoDReleaseDescrip
public final String getActionCommandResult() {
return scanAction;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public JsonNode getJsonNode(UnirestInstance unirest) {
}
FoDAppDescriptor appDescriptor = qualifiedMicroserviceNameResolver.getAppDescriptor(unirest, true);
FoDQualifiedMicroserviceNameDescriptor qualifiedMicroserviceNameDescriptor = qualifiedMicroserviceNameResolver.getQualifiedMicroserviceNameDescriptor();
// if the application is not microservice enabled, return the application descriptor with an additional field indicating that the microservice was not created due to the application not being microservice enabled
if (!appDescriptor.isHasMicroservices()) {
return appDescriptor.asObjectNode().put("__action__", "NOT_MICROSERVICE_ENABLED");
}
FoDMicroserviceUpdateRequest msCreateRequest = FoDMicroserviceUpdateRequest.builder()
.microserviceName(qualifiedMicroserviceNameDescriptor.getMicroserviceName())
.attributes(FoDAttributeHelper.getAttributesNode(unirest, FoDEnums.AttributeTypes.Microservice,
Expand Down
Loading