duo-labs / cloudmapper

CloudMapper helps you analyze your Amazon Web Services (AWS) environments.
BSD 3-Clause "New" or "Revised" License
5.9k stars 800 forks source link

Fix exception being thrown from unit test #817

Closed 0xdabbad00 closed 3 years ago

0xdabbad00 commented 3 years ago
$ ./tests/scripts/unit_tests.sh
......F.....................
======================================================================
FAIL: test_audit (test_audit.TestAudit)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/scottpiper/Documents/src/cloudmapper/tests/unit/test_audit.py", line 50, in test_audit
    "REQUEST_SMUGGLING"
AssertionError: Items in the first set but not the second:
'EXCEPTION'
Items in the second set but not the first:
'SQS_PUBLIC'
'SNS_PUBLIC'
'REQUEST_SMUGGLING'
-------------------- >> begin captured stdout << ---------------------
...
{"account_id": "123456789012", "account_name": "demo", "region": "us-east-1", "issue": "EXCEPTION", "resource": "'NoneType' object has no attribute 'get'", "details": {"exception": "'NoneType' object has no attribute 'get'", "traceback": "Traceback (most recent call last):\n  File \"/Users/scottpiper/Documents/src/cloudmapper/shared/audit.py\", line 1195, in audit\n    audit_elbv1(findings, region)\n  File \"/Users/scottpiper/Documents/src/cloudmapper/shared/audit.py\", line 852, in audit_elbv1\n    for attribute in attributes_json.get(\"LoadBalancerAttributes\", [])['AdditionalAttributes']:\nAttributeError: 'NoneType' object has no attribute 'get'\n"}}

Looks to be caused by the recent PR to check for request smuggling: #807