@@ -16,15 +16,28 @@ declare -a rulesets=("ncsc" "ncsc-cafv3" "wa-Reliability-Pillar" "wa-Security-Pi
1616# Create a custom NCSC ruleset that excludes the problematic rule
1717cp " /tmp/ruleset/output/ncsc.guard" " /tmp/ruleset/output/ncsc-custom.guard"
1818
19+ # Debug: Check if the rule exists before removal
20+ echo " Checking for LAMBDA_FUNCTION_PUBLIC_ACCESS_PROHIBITED rule..."
21+ grep -n " LAMBDA_FUNCTION_PUBLIC_ACCESS_PROHIBITED" " /tmp/ruleset/output/ncsc-custom.guard" || echo " Rule not found with exact name"
22+
1923# Remove the problematic Lambda function public access rule
20- # This rule is incompatible with standard AWS service integrations
24+ # Try multiple patterns to ensure we catch the rule
25+ sed -i ' /LAMBDA_FUNCTION_PUBLIC_ACCESS_PROHIBITED/,/^rule /d' " /tmp/ruleset/output/ncsc-custom.guard"
2126sed -i ' /LAMBDA_FUNCTION_PUBLIC_ACCESS_PROHIBITED/,/^$/d' " /tmp/ruleset/output/ncsc-custom.guard"
2227
28+ # Also try removing any remaining references
29+ grep -v " LAMBDA_FUNCTION_PUBLIC_ACCESS_PROHIBITED" " /tmp/ruleset/output/ncsc-custom.guard" > " /tmp/ncsc-temp.guard" || true
30+ mv " /tmp/ncsc-temp.guard" " /tmp/ruleset/output/ncsc-custom.guard" || true
31+
32+ echo " After removal, checking for remaining references..."
33+ grep -n " LAMBDA_FUNCTION_PUBLIC_ACCESS_PROHIBITED" " /tmp/ruleset/output/ncsc-custom.guard" || echo " ✅ Rule successfully removed"
34+
2335for ruleset in " ${rulesets[@]} "
2436do
2537 # Use custom NCSC ruleset that excludes the problematic rule
2638 if [ " $ruleset " = " ncsc" ]; then
2739 ruleset_file=" /tmp/ruleset/output/ncsc-custom.guard"
40+ echo " Using custom NCSC ruleset: $ruleset_file "
2841 else
2942 ruleset_file=" /tmp/ruleset/output/$ruleset .guard"
3043 fi
0 commit comments