Failed DAST jobs are shown as succeeded in pipeline
Summary
DAST jobs terminated with runtime errors like java.lang.OutOfMemoryError are shown as succeeded in pipeline. Looks like DAST job does not return an error exit code, which could be used by the runner to determine if the job ran successfully or not.
Steps to reproduce
This occurs when the DAST job terminates unexpectedly on a runtime error like out of memory error.
Example Project
- https://gitlab.com/gitlab-org/gitlab/-/jobs/658921824
- https://gitlab.com/gitlab-org/gitlab/-/jobs/658921823
- https://gitlab.com/gitlab-org/gitlab/-/jobs/657131425
What is the current bug behavior?
DAST jobs are shown as succeeded even when the job failed due to runtime errors.
What is the expected correct behavior?
DAST job should be shown as failed in the pipeline when the job fails dues to any runtime errors.
Relevant logs and/or screenshots
[zap.out] java.lang.OutOfMemoryError: Java heap space
[zap.out] at java.base/java.util.Arrays.copyOf(Arrays.java:3745)
[zap.out] at java.base/java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:120)
[zap.out] at java.base/java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:95)
[zap.out] at java.base/java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:156)
[zap.out] at org.codehaus.jackson.impl.Utf8Generator._flushBuffer(Utf8Generator.java:1748)
[zap.out] at org.codehaus.jackson.impl.Utf8Generator._writeStringSegment2(Utf8Generator.java:1294)
[zap.out] at org.codehaus.jackson.impl.Utf8Generator._writeStringSegment(Utf8Generator.java:1277)
[zap.out] at org.codehaus.jackson.impl.Utf8Generator._writeStringSegments(Utf8Generator.java:1209)
[zap.out] at org.codehaus.jackson.impl.Utf8Generator._writeLongString(Utf8Generator.java:575)
[zap.out] at org.codehaus.jackson.impl.Utf8Generator.writeString(Utf8Generator.java:550)
[zap.out] at org.codehaus.jackson.impl.Utf8Generator.writeStringField(Utf8Generator.java:262)
[zap.out] at edu.umass.cs.benchlab.har.HarContent.writeHar(HarContent.java:254)
[zap.out] at edu.umass.cs.benchlab.har.HarResponse.writeHar(HarResponse.java:352)
[zap.out] at edu.umass.cs.benchlab.har.HarEntry.writeHar(HarEntry.java:348)
[zap.out] at edu.umass.cs.benchlab.har.HarEntries.writeHar(HarEntries.java:161)
[zap.out] at edu.umass.cs.benchlab.har.HarLog.writeHar(HarLog.java:187)
[zap.out] at edu.umass.cs.benchlab.har.tools.HarFileWriter.writeHarFile(HarFileWriter.java:90)
[zap.out] at org.zaproxy.zap.utils.HarUtils.harLogToByteArray(HarUtils.java:112)
[zap.out] at org.zaproxy.zap.extension.api.CoreAPI.handleApiOther(CoreAPI.java:1497)
[zap.out] at org.zaproxy.zap.extension.api.API.handleApiRequest(API.java:544)
[zap.out] at org.parosproxy.paros.core.proxy.ProxyThread.processHttp(ProxyThread.java:499)
[zap.out] at org.parosproxy.paros.core.proxy.ProxyThread.run(ProxyThread.java:335)
[zap.out] at java.base/java.lang.Thread.run(Thread.java:834)
Uploading artifacts for successful job
00:01
Uploading artifacts...
WARNING: gl-dast-report.json: no matching files
ERROR: No files to upload
Uploading artifacts...
WARNING: gl-dast-report.json: no matching files
ERROR: No files to upload
Job succeeded
Edited by Cameron Swords