Skyscanner / cfripper

Library and CLI tool for analysing CloudFormation templates and check them for security compliance.

Home Page:https://cfripper.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

StackNameMatchesRegexRule crashed with AttributeError

rubendob opened this issue · comments

Hi guys

cfripper, version 1.15.1

I was just testing the filter rule option and taking the example from the readme I'm getting an exception

# cfripper cfripper/tests/test_templates/config/security_group_firehose_ips.json --rules-filters-folder cfripper/cfripper/config/rule_configs

StackNameMatchesRegexRule crashed with AttributeError for project - None, service - None, stack - None
Traceback (most recent call last):
  File "/Users/rubenortiz/Projects/Ruben/Deploybot/venv/lib/python3.9/site-packages/cfripper/rule_processor.py", line 24, in process_cf_template
    result += rule.invoke(cfmodel, extras)
  File "/Users/rubenortiz/Projects/Ruben/Deploybot/venv/lib/python3.9/site-packages/cfripper/rules/stack_name_matches_regex.py", line 31, in invoke
    stack_name = self._config.stack_name or extras.get("stack_name", "")
AttributeError: 'NoneType' object has no attribute 'get'
Valid: False
Issues found:
	- EC2SecurityGroupMissingEgressRule: Missing egress rule in RedshiftSecurityGroup means all traffic is allowed outbound. Make this explicit if it is desired configuration

Expected behavior: Valid True

Also I think I'm missing something in the command line, how can I pass the filter I want to test to the command?

Thanks

Oh, I'm afraid you found an issue introduced by a new rule in 1.15. We'll get it fixed soon, but until then 1.14 should do the trick, there aren't many changes.

Release v1.15.2, containing the fix for this issue.