Skip to content

Commit 86034d5

Browse files
committed
Remove django-DefectDojo from git tracking and add XML BOM generation
1 parent babd063 commit 86034d5

5 files changed

Lines changed: 78 additions & 4 deletions

File tree

.github/workflows/devsecops-pipeline.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,21 @@ jobs:
186186
# Create docs/reports directory if it doesn't exist
187187
- name: Ensure docs/reports directory exists
188188
run: mkdir -p ./docs/reports
189+
190+
# Generate SBOM using direct script
191+
- name: Generate XML BOMs using script
192+
run: |
193+
chmod +x ./.github/workflows/scripts/bom_generate.sh
194+
./.github/workflows/scripts/bom_generate.sh
189195
190-
# Generate SBOM for Backend (API)
196+
# Generate JSON SBOM for Backend (API)
191197
- name: Generate API SBOM with CycloneDX
192198
uses: CycloneDX/gh-node-module-generatebom@master
193199
with:
194200
path: './xss/api'
195201
output: './docs/reports/angular-xss-api-sbom.json'
196202

197-
# Generate SBOM for Frontend
203+
# Generate JSON SBOM for Frontend
198204
- name: Generate Frontend SBOM with CycloneDX
199205
uses: CycloneDX/gh-node-module-generatebom@master
200206
with:
@@ -206,9 +212,12 @@ jobs:
206212
run: |
207213
# Create a directory for all SBOM files
208214
mkdir -p ./docs/reports/sbom
209-
# Copy the generated SBOMs to this directory
215+
# Copy the generated JSON SBOMs to this directory
210216
cp ./docs/reports/angular-xss-api-sbom.json ./docs/reports/sbom/
211217
cp ./docs/reports/angular-xss-frontend-sbom.json ./docs/reports/sbom/
218+
# Copy the generated XML SBOMs to this directory if they exist
219+
[ -f ./docs/reports/api-bom.xml ] && cp ./docs/reports/api-bom.xml ./docs/reports/sbom/
220+
[ -f ./docs/reports/frontend-bom.xml ] && cp ./docs/reports/frontend-bom.xml ./docs/reports/sbom/
212221
213222
- name: Upload SBOM as artifact
214223
uses: actions/upload-artifact@v4
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# Script to generate CycloneDX BOMs for API and Frontend
4+
echo "===== Generating CycloneDX BOMs for Angular XSS ====="
5+
6+
# Create reports directory
7+
mkdir -p ./docs/reports
8+
9+
# Generate BOM for API
10+
echo "Generating BOM for API..."
11+
cd ./xss/api
12+
npm install
13+
npm install -g cyclonedx-bom
14+
cyclonedx-bom -o api-bom.xml
15+
cp api-bom.xml ../../docs/reports/
16+
echo "API BOM generated at docs/reports/api-bom.xml"
17+
18+
# Generate BOM for Frontend
19+
echo "Generating BOM for Frontend..."
20+
cd ../frontend
21+
npm install
22+
cyclonedx-bom -o frontend-bom.xml
23+
cp frontend-bom.xml ../../docs/reports/
24+
echo "Frontend BOM generated at docs/reports/frontend-bom.xml"
25+
26+
# Return to the project root
27+
cd ../..
28+
echo "===== BOM generation complete ====="

django-DefectDojo

Lines changed: 0 additions & 1 deletion
This file was deleted.

import-to-defectdojo.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,42 @@ else
132132
echo "Frontend SBOM file not found or empty: $REPORTS_DIR/angular-xss-frontend-sbom.json"
133133
fi
134134

135+
# Check for XML API SBOM
136+
if [ -f "$REPORTS_DIR/api-bom.xml" ] && [ -s "$REPORTS_DIR/api-bom.xml" ]; then
137+
echo "Importing XML API SBOM report: $REPORTS_DIR/api-bom.xml"
138+
IMPORT_RESPONSE=$(curl -s -X POST \
139+
-H "Authorization: Token $API_TOKEN" \
140+
-H "Content-Type: multipart/form-data" \
141+
-F "file=@$REPORTS_DIR/api-bom.xml" \
142+
-F "scan_type=CycloneDX" \
143+
-F "engagement=$ENGAGEMENT_ID" \
144+
-F "close_old_findings=false" \
145+
-F "scan_date=$(date +"%Y-%m-%d")" \
146+
"$DEFECTDOJO_URL/api/v2/import-scan/")
147+
148+
echo "XML API SBOM Import response: $IMPORT_RESPONSE"
149+
else
150+
echo "XML API SBOM file not found or empty: $REPORTS_DIR/api-bom.xml"
151+
fi
152+
153+
# Check for XML Frontend SBOM
154+
if [ -f "$REPORTS_DIR/frontend-bom.xml" ] && [ -s "$REPORTS_DIR/frontend-bom.xml" ]; then
155+
echo "Importing XML Frontend SBOM report: $REPORTS_DIR/frontend-bom.xml"
156+
IMPORT_RESPONSE=$(curl -s -X POST \
157+
-H "Authorization: Token $API_TOKEN" \
158+
-H "Content-Type: multipart/form-data" \
159+
-F "file=@$REPORTS_DIR/frontend-bom.xml" \
160+
-F "scan_type=CycloneDX" \
161+
-F "engagement=$ENGAGEMENT_ID" \
162+
-F "close_old_findings=false" \
163+
-F "scan_date=$(date +"%Y-%m-%d")" \
164+
"$DEFECTDOJO_URL/api/v2/import-scan/")
165+
166+
echo "XML Frontend SBOM Import response: $IMPORT_RESPONSE"
167+
else
168+
echo "XML Frontend SBOM file not found or empty: $REPORTS_DIR/frontend-bom.xml"
169+
fi
170+
135171
# Check for combined/old format SBOM as fallback
136172
if [ -f "$REPORTS_DIR/angular-xss-sbom.json" ] && [ -s "$REPORTS_DIR/angular-xss-sbom.json" ]; then
137173
echo "Importing combined SBOM report: $REPORTS_DIR/angular-xss-sbom.json"

verify-reports.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ declare -a EXPECTED_REPORTS=(
2323
"dependency-check-*.sarif"
2424
"angular-xss-api-sbom.json"
2525
"angular-xss-frontend-sbom.json"
26+
"api-bom.xml"
27+
"frontend-bom.xml"
2628
"report_json.json"
2729
"report_xml.xml"
2830
"report_html.html"

0 commit comments

Comments
 (0)