Skip to content

Commit b27f40f

Browse files
committed
DevSecOps test
1 parent 205b6b2 commit b27f40f

2 files changed

Lines changed: 61 additions & 17 deletions

File tree

.github/workflows/devsecops-pipeline.yml

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -419,42 +419,95 @@ jobs:
419419
ls -la zap-rules.tsv
420420
cat zap-rules.tsv
421421
422+
# Create a temporary directory with proper permissions for ZAP to write reports
423+
- name: Create writable temp directory for ZAP
424+
run: |
425+
mkdir -p /tmp/zap-output
426+
chmod 777 /tmp/zap-output
427+
echo "Created writable directory for ZAP reports at /tmp/zap-output"
428+
ls -la /tmp/zap-output
429+
422430
- name: ZAP Baseline Scan
423431
uses: zaproxy/action-baseline@v0.11.0
424432
continue-on-error: true
425433
with:
426434
target: 'http://localhost:4200'
427435
allow_issue_writing: true
428-
cmd_options: '-a -j -T 10 -w zap-baseline-report.md'
436+
# Use Docker's /tmp directory which should be writable
437+
cmd_options: '-a -j -T 10 -w /tmp/zap-output/zap-baseline-report.md'
429438
rules_file_name: 'zap-rules.tsv'
430439
issue_title: 'ZAP Baseline Scan Report'
431440
artifact_name: 'zap-baseline-report'
441+
docker_name: 'ghcr.io/zaproxy/zaproxy:stable'
432442

433443
- name: ZAP Full Scan
434444
uses: zaproxy/action-full-scan@v0.8.0
435445
continue-on-error: true
436446
with:
437447
target: 'http://localhost:4200'
438448
allow_issue_writing: true
439-
cmd_options: '-a -j -T 10 -w zap-full-scan-report.md'
449+
# Use Docker's /tmp directory which should be writable
450+
cmd_options: '-a -j -T 10 -w /tmp/zap-output/zap-full-scan-report.md'
440451
rules_file_name: 'zap-rules.tsv'
441452
issue_title: 'ZAP Full Scan Report'
453+
docker_name: 'ghcr.io/zaproxy/zaproxy:stable'
442454

443455
# Copy ZAP reports to docs/reports directory
444456
- name: Copy ZAP reports to docs/reports
445457
run: |
446-
echo "Looking for ZAP report files..."
447-
find . -maxdepth 1 -name "*report*.md" -o -name "*report*.html" -o -name "*report*.json"
458+
echo "Looking for ZAP report files in various locations..."
459+
460+
# Check in /tmp/zap-output where we directed ZAP to write reports
461+
echo "Checking in /tmp/zap-output:"
462+
ls -la /tmp/zap-output || echo "Directory not found"
463+
464+
# Check in current directory
465+
echo "Checking in current directory:"
466+
find . -maxdepth 2 -name "*report*.md" -o -name "*report*.html" -o -name "*report*.json"
467+
468+
# Try to copy from our specific ZAP output directory first
469+
if [ -d "/tmp/zap-output" ]; then
470+
echo "Copying reports from /tmp/zap-output:"
471+
cp -v /tmp/zap-output/*.* ./docs/reports/ 2>/dev/null || echo "No files to copy from /tmp/zap-output"
472+
fi
448473
449-
# Try multiple possible filenames for the reports
450-
for report in zap-baseline-report.md baseline-report.md report_md.md zap-full-scan-report.md full-scan-report.md; do
474+
# Then try multiple possible filenames and locations for the reports
475+
for report in \
476+
./zap-baseline-report.md \
477+
./zap-full-scan-report.md \
478+
./baseline-report.md \
479+
./full-scan-report.md \
480+
./report_md.md \
481+
/tmp/zap-baseline-report.md \
482+
/tmp/zap-full-scan-report.md \
483+
/zap/wrk/zap-baseline-report.md \
484+
/zap/wrk/zap-full-scan-report.md; do
451485
if [ -f "$report" ]; then
452486
echo "Found report: $report"
453-
cp "$report" ./docs/reports/
487+
cp -v "$report" ./docs/reports/
454488
fi
455489
done
456490
457-
# Check if any reports were copied
491+
# If no reports were found, create placeholders
492+
if [ ! -f "./docs/reports/zap-baseline-report.md" ] && [ ! -f "./docs/reports/baseline-report.md" ]; then
493+
echo "Creating placeholder for ZAP baseline report"
494+
echo "# ZAP Baseline Scan Report (Placeholder)
495+
496+
This is a placeholder for the ZAP baseline scan report.
497+
The actual scan may have failed to generate a report file due to permissions issues.
498+
" > ./docs/reports/zap-baseline-report.md
499+
fi
500+
501+
if [ ! -f "./docs/reports/zap-full-scan-report.md" ] && [ ! -f "./docs/reports/full-scan-report.md" ]; then
502+
echo "Creating placeholder for ZAP full scan report"
503+
echo "# ZAP Full Scan Report (Placeholder)
504+
505+
This is a placeholder for the ZAP full scan report.
506+
The actual scan may have failed to generate a report file due to permissions issues.
507+
" > ./docs/reports/zap-full-scan-report.md
508+
fi
509+
510+
# Check if any reports were copied or created
458511
echo "Contents of docs/reports directory:"
459512
ls -la ./docs/reports/
460513

docs/reports/README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,3 @@ Markdown files (.md) can be viewed with any Markdown viewer or GitHub's web inte
3838

3939
## DefectDojo Integration
4040
These reports are automatically imported into DefectDojo for centralized vulnerability management.
41-
- **zap-reports**
42-
- [README.md](./README.md)
43-
- [report_md.md](./report_md.md)
44-
- **zap-reports**
45-
- [README.md](./README.md)
46-
- [angular-xss-sbom.json](./angular-xss-sbom.json)
47-
- [codeql-results.sarif](./codeql-results.sarif)
48-
- [dependency-check-report.sarif](./dependency-check-report.sarif)
49-
- [report_md.md](./report_md.md)

0 commit comments

Comments
 (0)