@@ -319,12 +319,35 @@ jobs:
319319 - name : Ensure docs/reports directory exists
320320 run : mkdir -p ./docs/reports
321321
322- # Copy ZAP rules file to the workspace root for the scan
323- - name : Copy ZAP rules file to workspace root
322+ # Create and verify ZAP rules file for scanning
323+ - name : Set up ZAP rules file
324324 run : |
325- cp ./zap-rules.tsv ./
326- echo "Verifying ZAP rules file location:"
327- ls -la zap-rules.tsv || echo "ZAP rules file not found in root"
325+ # Check if zap-rules.tsv exists in the repo
326+ echo "Checking for ZAP rules files..."
327+ echo "Current directory: $(pwd)"
328+ ls -la
329+
330+ if [ -f "zap-rules.tsv" ]; then
331+ echo "ZAP rules file already exists in the root directory"
332+ elif [ -f "./angular-xss/zap-rules.tsv" ]; then
333+ echo "Found ZAP rules in angular-xss directory, copying to root"
334+ cp ./angular-xss/zap-rules.tsv ./
335+ else
336+ echo "ZAP rules file not found, creating a basic one"
337+ cat > zap-rules.tsv << 'EOL'
338+ 10016 IGNORE http://localhost:4200 (IGNORE : A technology has been identified)
339+ 10020 IGNORE http://localhost:4200 (IGNORE : X-Frame-Options Header Not Set)
340+ 10021 IGNORE http://localhost:4200 (IGNORE : X-Content-Type-Options Header Missing)
341+ 10038 IGNORE http://localhost:4200 (IGNORE : Content Security Policy (CSP) Header Not Set)
342+ 10049 IGNORE http://localhost:4200 (IGNORE : Non-Storable Content)
343+ 40012 FAIL http://localhost:4200 (FAIL : Cross Site Scripting (Reflected))
344+ EOL
345+ fi
346+
347+ # Verify the rules file exists and show content
348+ echo "Verifying ZAP rules file location and content:"
349+ ls -la zap-rules.tsv
350+ cat zap-rules.tsv
328351
329352 - name : ZAP Baseline Scan
330353 uses : zaproxy/action-baseline@v0.11.0
0 commit comments