google / gcp_scanner

A comprehensive scanner for Google Cloud
Apache License 2.0
304 stars 95 forks source link

GCP Scanner freezes when there is an error in project scanning crawler #271

Closed mshudrak closed 10 months ago

mshudrak commented 11 months ago

Affected Component

Describe the bug GCP Scanner freezes when there is an error in project scanning crawler

To Reproduce Run the scanner with -o res and make sure res folder does not exist.

Current behavior The scanner freezes indefinetely

Additional context Related to new parallelization change https://github.com/google/gcp_scanner/pull/265 and https://github.com/google/gcp_scanner/pull/269. PyPI version is not affected.

peb-peb commented 11 months ago

The reason for this bug would be the following piece of code: https://github.com/google/gcp_scanner/blob/418621d08f7d58d771f4509d9e80c903f206a4dd/src/gcp_scanner/scanner.py#L159-L165 Here, the except block doesn't catch the error when the destination file doesn't exists. So, the program results in a hanging bug (maybe it is not able to write to file). Instead of catching the error here, we can verify it at arguments.py, from where we take the user input for the tool.