@@ -105,46 +105,105 @@ if [ -f "${REPORTS_DIR}/angular-xss-sbom.json" ]; then
105105 fi
106106fi
107107
108- # Import ZAP Baseline Scan Results
109- if [ -f " ${REPORTS_DIR} /baseline-report.md " ]; then
110- echo " Importing ZAP Baseline Scan results..."
108+ # Import ZAP Baseline Scan Results (XML format)
109+ if [ -f " ${REPORTS_DIR} /zap- baseline-report.xml " ]; then
110+ echo " Importing ZAP Baseline Scan results (XML) ..."
111111 curl -X POST \
112112 -H " Authorization: Token ${API_KEY} " \
113113 -H " Content-Type: multipart/form-data" \
114- -F " file=@${REPORTS_DIR} /baseline-report.md " \
114+ -F " file=@${REPORTS_DIR} /zap- baseline-report.xml " \
115115 -F " scan_type=ZAP Scan" \
116116 -F " engagement=${ENGAGEMENT_ID} " \
117117 -F " close_old_findings=false" \
118118 -F " scan_date=$( date +" %Y-%m-%d" ) " \
119119 " ${DEFECTDOJO_URL} /api/v2/import-scan/"
120120
121121 if [ $? -ne 0 ]; then
122- echo " Error importing ZAP Baseline Scan results"
122+ echo " Error importing ZAP Baseline Scan XML results"
123123 else
124- echo " Successfully imported ZAP Baseline Scan results"
124+ echo " Successfully imported ZAP Baseline Scan XML results"
125125 fi
126126fi
127127
128- # Import ZAP Full Scan Results
129- if [ -f " ${REPORTS_DIR} /full-scan -report.md " ]; then
130- echo " Importing ZAP Full Scan results..."
128+ # Import ZAP Baseline Scan Results (JSON format)
129+ if [ -f " ${REPORTS_DIR} /zap-baseline -report.json " ]; then
130+ echo " Importing ZAP Baseline Scan results (JSON) ..."
131131 curl -X POST \
132132 -H " Authorization: Token ${API_KEY} " \
133133 -H " Content-Type: multipart/form-data" \
134- -F " file=@${REPORTS_DIR} /full-scan -report.md " \
134+ -F " file=@${REPORTS_DIR} /zap-baseline -report.json " \
135135 -F " scan_type=ZAP Scan" \
136136 -F " engagement=${ENGAGEMENT_ID} " \
137137 -F " close_old_findings=false" \
138138 -F " scan_date=$( date +" %Y-%m-%d" ) " \
139139 " ${DEFECTDOJO_URL} /api/v2/import-scan/"
140140
141141 if [ $? -ne 0 ]; then
142- echo " Error importing ZAP Full Scan results"
142+ echo " Error importing ZAP Baseline Scan JSON results"
143143 else
144- echo " Successfully imported ZAP Full Scan results"
144+ echo " Successfully imported ZAP Baseline Scan JSON results"
145145 fi
146146fi
147147
148+ # Import ZAP Full Scan Results (XML format)
149+ if [ -f " ${REPORTS_DIR} /zap-full-scan-report.xml" ]; then
150+ echo " Importing ZAP Full Scan results (XML)..."
151+ curl -X POST \
152+ -H " Authorization: Token ${API_KEY} " \
153+ -H " Content-Type: multipart/form-data" \
154+ -F " file=@${REPORTS_DIR} /zap-full-scan-report.xml" \
155+ -F " scan_type=ZAP Scan" \
156+ -F " engagement=${ENGAGEMENT_ID} " \
157+ -F " close_old_findings=false" \
158+ -F " scan_date=$( date +" %Y-%m-%d" ) " \
159+ " ${DEFECTDOJO_URL} /api/v2/import-scan/"
160+
161+ if [ $? -ne 0 ]; then
162+ echo " Error importing ZAP Full Scan XML results"
163+ else
164+ echo " Successfully imported ZAP Full Scan XML results"
165+ fi
166+ fi
167+
168+ # Import ZAP Full Scan Results (JSON format)
169+ if [ -f " ${REPORTS_DIR} /zap-full-scan-report.json" ]; then
170+ echo " Importing ZAP Full Scan results (JSON)..."
171+ curl -X POST \
172+ -H " Authorization: Token ${API_KEY} " \
173+ -H " Content-Type: multipart/form-data" \
174+ -F " file=@${REPORTS_DIR} /zap-full-scan-report.json" \
175+ -F " scan_type=ZAP Scan" \
176+ -F " engagement=${ENGAGEMENT_ID} " \
177+ -F " close_old_findings=false" \
178+ -F " scan_date=$( date +" %Y-%m-%d" ) " \
179+ " ${DEFECTDOJO_URL} /api/v2/import-scan/"
180+
181+ if [ $? -ne 0 ]; then
182+ echo " Error importing ZAP Full Scan JSON results"
183+ else
184+ echo " Successfully imported ZAP Full Scan JSON results"
185+ fi
186+ fi
187+
188+ # Fallback to older report naming if available
189+ for report_type in " baseline" " full-scan" ; do
190+ for report_format in " md" " xml" " json" ; do
191+ report_file=" ${REPORTS_DIR} /${report_type} -report.${report_format} "
192+ if [ -f " $report_file " ] && [ ! -f " ${REPORTS_DIR} /zap-${report_type} -report.${report_format} " ]; then
193+ echo " Found legacy format report: $report_file , importing..."
194+ curl -X POST \
195+ -H " Authorization: Token ${API_KEY} " \
196+ -H " Content-Type: multipart/form-data" \
197+ -F " file=@${report_file} " \
198+ -F " scan_type=ZAP Scan" \
199+ -F " engagement=${ENGAGEMENT_ID} " \
200+ -F " close_old_findings=false" \
201+ -F " scan_date=$( date +" %Y-%m-%d" ) " \
202+ " ${DEFECTDOJO_URL} /api/v2/import-scan/"
203+ fi
204+ done
205+ done
206+
148207# Import CodeQL Results
149208if [ -f " ${REPORTS_DIR} /codeql-results.sarif" ]; then
150209 echo " Importing CodeQL SAST results..."
0 commit comments