Skip to content

Commit 5c15c52

Browse files
committed
NV-4462 Surface the demo scan's error output on failure
The scan step redirects stdout to scan-results.txt (its first line feeds the SARIF export), which also swallows any scan error, so a failed scan ends the step with exit 1 and no diagnostic. Wrap the scan so that on failure it prints the captured output and then fails, making credential/target/connectivity errors visible in the Actions log instead of opaque.
1 parent 5629003 commit 5c15c52

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

.github/workflows/nightvision.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,14 @@ jobs:
7878
7979
- name: (5) Scan the API
8080
run: |
81-
nightvision scan ${NIGHTVISION_TARGET} --auth ${NIGHTVISION_AUTH} > scan-results.txt
81+
# stdout is redirected to scan-results.txt (its first line feeds the export
82+
# below), which also swallows any scan error. Print the captured output and
83+
# fail explicitly so a scan failure is diagnosable instead of opaque. (NV-4462.)
84+
if ! nightvision scan ${NIGHTVISION_TARGET} --auth ${NIGHTVISION_AUTH} > scan-results.txt; then
85+
echo "nightvision scan failed; captured output:"
86+
cat scan-results.txt
87+
exit 1
88+
fi
8289
nightvision export sarif -s "$(head -n 1 scan-results.txt)" --swagger-file openapi-spec.yml
8390
8491
- name: (6) Upload SARIF file to GitHub Security Alerts if vulnerabilities are found

0 commit comments

Comments
 (0)