duo-labs / cloudmapper

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

Weboftrust fails if there are no SAML providerws #918

Open gad-imageinsight opened 2 years ago

gad-imageinsight commented 2 years ago

Note the Network Visualization functionality (command prepare) is no longer maintained.

Please mention the following:

Command crashed with the following report:

(venv) 16:03 75> python3 cloudmapper.py weboftrust --accounts i-i-i
Traceback (most recent call last):
  File "/Users/gad/ImageInsight/Code/cloudmapper/cloudmapper.py", line 72, in <module>
    main()
  File "/Users/gad/ImageInsight/Code/cloudmapper/cloudmapper.py", line 66, in main
    commands[command].run(arguments)
  File "/Users/gad/ImageInsight/Code/cloudmapper/commands/weboftrust.py", line 568, in run
    cytoscape_json = weboftrust(args, accounts, config)
  File "/Users/gad/ImageInsight/Code/cloudmapper/commands/weboftrust.py", line 449, in weboftrust
    get_nodes_and_connections(account, nodes, connections, args)
  File "/Users/gad/ImageInsight/Code/cloudmapper/commands/weboftrust.py", line 430, in get_nodes_and_connections
    get_iam_trusts(account, nodes, connections, connections_to_get)
  File "/Users/gad/ImageInsight/Code/cloudmapper/commands/weboftrust.py", line 204, in get_iam_trusts
    if 'saml-provider/okta' in saml_provider_arn.lower():
UnboundLocalError: local variable 'saml_provider_arn' referenced before assignment

Issue is that the code is assuming that the line for saml in saml_providers will be a non-null loop. In my case, this fails, so saml_provider_arn does not exist to be tested in the subsequent block of if statements.