Fix nginx test workflow paths

The nginx_waf.zip extracts files directly to the target directory,
not into waf_patterns/nginx/ subdirectory. Updated paths accordingly.
This commit is contained in:
Fabrizio Salmi 2025-12-09 08:09:21 +01:00
parent ea474cbcf2
commit a6f372e0c9

View File

@ -29,20 +29,18 @@ jobs:
run: | run: |
unzip nginx_waf.zip -d waf_rules unzip nginx_waf.zip -d waf_rules
echo "Extracted WAF rules into waf_rules directory" echo "Extracted WAF rules into waf_rules directory"
ls -lh waf_rules/waf_patterns/nginx/ ls -lh waf_rules/
- name: Verify WAF rules extraction - name: Verify WAF rules extraction
run: | run: |
if [ ! -d "waf_rules/waf_patterns/nginx" ]; then if [ -z "$(ls -A waf_rules/*.conf 2>/dev/null)" ]; then
echo "Error: WAF rules directory not found after extraction!" echo "Error: No .conf files found in waf_rules/"
exit 1 echo "Contents of waf_rules/:"
fi ls -l waf_rules/
if [ -z "$(ls -A waf_rules/waf_patterns/nginx/*.conf 2>/dev/null)" ]; then
echo "Error: No .conf files found in waf_rules/waf_patterns/nginx/"
echo "Contents of waf_rules/waf_patterns/nginx/:"
ls -l waf_rules/waf_patterns/nginx/
exit 1 exit 1
fi fi
echo "Found WAF configuration files:"
ls -l waf_rules/*.conf
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
@ -56,7 +54,7 @@ jobs:
- name: Validate individual WAF rule files - name: Validate individual WAF rule files
run: | run: |
for file in waf_rules/waf_patterns/nginx/*.conf; do for file in waf_rules/*.conf; do
echo "Validating $file..." echo "Validating $file..."
# Use crossplane to parse and validate the file # Use crossplane to parse and validate the file
if ! crossplane parse "$file" > /dev/null; then if ! crossplane parse "$file" > /dev/null; then
@ -71,7 +69,7 @@ jobs:
run: | run: |
echo "Merging all WAF rules into a single file..." echo "Merging all WAF rules into a single file..."
echo "http {" > merged_waf_rules.conf echo "http {" > merged_waf_rules.conf
for file in waf_rules/waf_patterns/nginx/*.conf; do for file in waf_rules/*.conf; do
echo "Merging $file..." echo "Merging $file..."
cat "$file" >> merged_waf_rules.conf cat "$file" >> merged_waf_rules.conf
echo "" >> merged_waf_rules.conf echo "" >> merged_waf_rules.conf
@ -91,3 +89,4 @@ jobs:
exit 1 exit 1
fi fi
echo "Validation successful for merged_waf_rules.conf" echo "Validation successful for merged_waf_rules.conf"