ScoutSuite icon indicating copy to clipboard operation
ScoutSuite copied to clipboard

ERROR provider.py L372: 'NoneType' object has no attribute 'replace'

Open miettal opened this issue 3 years ago • 4 comments

Describe the bug

When executing scout command, Error message is shown.

To Reproduce

$ scout aws --region ap-northeast-1
2022-01-07 21:22:20 Iharas-Air scout[68270] INFO Launching Scout
2022-01-07 21:22:20 Iharas-Air scout[68270] INFO Authenticating to cloud provider
2022-01-07 21:22:25 Iharas-Air scout[68270] INFO Gathering data from APIs
2022-01-07 21:22:25 Iharas-Air scout[68270] INFO Fetching resources for the ACM service
2022-01-07 21:22:26 Iharas-Air scout[68270] INFO Fetching resources for the Lambda service
2022-01-07 21:22:27 Iharas-Air scout[68270] INFO Fetching resources for the CloudFormation service
2022-01-07 21:22:28 Iharas-Air scout[68270] INFO Fetching resources for the CloudTrail service
2022-01-07 21:22:29 Iharas-Air scout[68270] INFO Fetching resources for the CloudWatch service
2022-01-07 21:22:30 Iharas-Air scout[68270] INFO Fetching resources for the CloudFront service
2022-01-07 21:22:31 Iharas-Air scout[68270] INFO Fetching resources for the CodeBuild service
2022-01-07 21:22:32 Iharas-Air scout[68270] INFO Fetching resources for the Config service
2022-01-07 21:22:33 Iharas-Air scout[68270] INFO Fetching resources for the Direct Connect service
2022-01-07 21:22:33 Iharas-Air scout[68270] INFO Fetching resources for the DynamoDB service
2022-01-07 21:22:34 Iharas-Air scout[68270] INFO Fetching resources for the EC2 service
2022-01-07 21:22:35 Iharas-Air scout[68270] INFO Fetching resources for the EFS service
2022-01-07 21:22:36 Iharas-Air scout[68270] INFO Fetching resources for the ElastiCache service
2022-01-07 21:22:37 Iharas-Air scout[68270] INFO Fetching resources for the ELB service
2022-01-07 21:22:38 Iharas-Air scout[68270] INFO Fetching resources for the ELBv2 service
2022-01-07 21:22:39 Iharas-Air scout[68270] INFO Fetching resources for the EMR service
2022-01-07 21:22:40 Iharas-Air scout[68270] INFO Fetching resources for the IAM service
2022-01-07 21:22:40 Iharas-Air scout[68270] INFO Fetching resources for the KMS service
2022-01-07 21:22:41 Iharas-Air scout[68270] INFO Fetching resources for the RDS service
2022-01-07 21:22:42 Iharas-Air scout[68270] INFO Fetching resources for the RedShift service
2022-01-07 21:22:43 Iharas-Air scout[68270] INFO Fetching resources for the Route53 service
2022-01-07 21:22:44 Iharas-Air scout[68270] INFO Fetching resources for the S3 service
2022-01-07 21:22:46 Iharas-Air scout[68270] INFO Fetching resources for the SES service
2022-01-07 21:22:47 Iharas-Air scout[68270] INFO Fetching resources for the SNS service
2022-01-07 21:22:48 Iharas-Air scout[68270] INFO Fetching resources for the SQS service
2022-01-07 21:22:49 Iharas-Air scout[68270] INFO Fetching resources for the VPC service
2022-01-07 21:22:49 Iharas-Air scout[68270] INFO Fetching resources for the Secrets Manager service
2022-01-07 21:24:00 Iharas-Air scout[68270] INFO Running pre-processing engine
2022-01-07 21:24:00 Iharas-Air scout[68270] ERROR provider.py L372: 'NoneType' object has no attribute 'replace'
2022-01-07 21:24:00 Iharas-Air scout[68270] ERROR provider.py L372: 'NoneType' object has no attribute 'replace'
2022-01-07 21:24:00 Iharas-Air scout[68270] ERROR provider.py L372: 'NoneType' object has no attribute 'replace'
2022-01-07 21:24:00 Iharas-Air scout[68270] ERROR provider.py L372: 'NoneType' object has no attribute 'replace'
2022-01-07 21:24:00 Iharas-Air scout[68270] INFO Running rule engine
2022-01-07 21:24:02 Iharas-Air scout[68270] INFO Applying display filters
2022-01-07 21:24:02 Iharas-Air scout[68270] INFO Running post-processing engine
2022-01-07 21:24:02 Iharas-Air scout[68270] INFO Saving data to scoutsuite-report/scoutsuite-results/scoutsuite_results_aws-xxx.js
2022-01-07 21:24:10 Iharas-Air scout[68270] INFO Saving data to scoutsuite-report/scoutsuite-results/scoutsuite_exceptions_aws-xxx.js
2022-01-07 21:24:10 Iharas-Air scout[68270] INFO Saving data to scoutsuite-report/scoutsuite-results/scoutsuite_errors_aws-xxx.json

2022-01-07 21:24:11 Iharas-Air scout[68270] INFO Creating scoutsuite-report/aws-xxx.html
2022-01-07 21:24:11 Iharas-Air scout[68270] INFO Opening the HTML report
$ scout aws --region ap-northeast-1 --debug
(snip)
2022-01-07 21:27:11 Iharas-Air scout[68564] INFO Running pre-processing engine
2022-01-07 21:27:11 Iharas-Air scout[68564] ERROR provider.py L372: 'NoneType' object has no attribute 'replace'
Traceback (most recent call last):
  File "/Users/taisyo/.pyenv/versions/3.8-dev/lib/python3.8/site-packages/ScoutSuite/providers/base/provider.py", line 372, in _new_go_to_and_do
    callback(current_config[key][value],
  File "/Users/taisyo/.pyenv/versions/3.8-dev/lib/python3.8/site-packages/ScoutSuite/providers/aws/provider.py", line 561, in match_security_groups_and_resources_callback
    resource_status = get_object_at(self, status_path).replace('.', '_')
AttributeError: 'NoneType' object has no attribute 'replace'
2022-01-07 21:27:11 Iharas-Air scout[68564] ERROR provider.py L372: 'NoneType' object has no attribute 'replace'
Traceback (most recent call last):
  File "/Users/taisyo/.pyenv/versions/3.8-dev/lib/python3.8/site-packages/ScoutSuite/providers/base/provider.py", line 372, in _new_go_to_and_do
    callback(current_config[key][value],
  File "/Users/taisyo/.pyenv/versions/3.8-dev/lib/python3.8/site-packages/ScoutSuite/providers/aws/provider.py", line 561, in match_security_groups_and_resources_callback
    resource_status = get_object_at(self, status_path).replace('.', '_')
AttributeError: 'NoneType' object has no attribute 'replace'
2022-01-07 21:27:11 Iharas-Air scout[68564] ERROR provider.py L372: 'NoneType' object has no attribute 'replace'
Traceback (most recent call last):
  File "/Users/taisyo/.pyenv/versions/3.8-dev/lib/python3.8/site-packages/ScoutSuite/providers/base/provider.py", line 372, in _new_go_to_and_do
    callback(current_config[key][value],
  File "/Users/taisyo/.pyenv/versions/3.8-dev/lib/python3.8/site-packages/ScoutSuite/providers/aws/provider.py", line 561, in match_security_groups_and_resources_callback
    resource_status = get_object_at(self, status_path).replace('.', '_')
AttributeError: 'NoneType' object has no attribute 'replace'
2022-01-07 21:27:11 Iharas-Air scout[68564] ERROR provider.py L372: 'NoneType' object has no attribute 'replace'
Traceback (most recent call last):
  File "/Users/taisyo/.pyenv/versions/3.8-dev/lib/python3.8/site-packages/ScoutSuite/providers/base/provider.py", line 372, in _new_go_to_and_do
    callback(current_config[key][value],
  File "/Users/taisyo/.pyenv/versions/3.8-dev/lib/python3.8/site-packages/ScoutSuite/providers/aws/provider.py", line 561, in match_security_groups_and_resources_callback
    resource_status = get_object_at(self, status_path).replace('.', '_')
AttributeError: 'NoneType' object has no attribute 'replace'
2022-01-07 21:27:11 Iharas-Air scout[68564] INFO Running rule engine
(snip)

Additional context

↑this result is in 5.11.0RC3, but 5.10 also have same problem.

$ scout --version
Scout Suite 5.11.0RC3
$ python --version
Python 3.8.11

miettal avatar Jan 07 '22 12:01 miettal

Hi,

I'm unable to reproduce this issue. Do you know if you have any specific conditions (resources on the account) that trigger this bug?

alessandrogonzalez avatar Jan 13 '22 15:01 alessandrogonzalez

I also have this exact issue tracked it down to a lambda with "Package type" = "Image" (instead of Zip) and "Runtime" = "-" (aka None in python)

rhuddleston avatar Apr 01 '22 03:04 rhuddleston

@alessandrogonzalez let me know if you have any questions on this

rhuddleston avatar Apr 04 '22 17:04 rhuddleston

Hi @miettal, are you still experiencing this issue in version 5.12.0?

fernando-gallego avatar Sep 12 '22 11:09 fernando-gallego

sorry for late reply. today I checked again on latest version 5.12.0. there is no failure. Thank you for fixing it.

miettal avatar Nov 17 '22 05:11 miettal