Open timretout opened 3 years ago
While I've opened #942 to fix the immediate problem, I suspect the Cloud Asset API might still be a better choice for scaling to larger organizations - e.g. with >240 projects hitting Service Usage will probably fail even after the caching is fixed.
The Cloud Asset API allows searches of resources across multiple projects, and has a default quota of 600 searches per minute.
Gotcha, we'll look into it.
An alternative is to fix ScoutSuite to handle and retry 429 responses with exponential backoff.
This should already be the case, I guess those specific requests aren't being handled adequately (this is hard to test as our dev environment isn't that large).
Additionally, I believe using this API would simplify granting permissions to permit scanning on GCP,
Can you expand on this?
and resolve a separate issue where IAM roles are not scanned on projects unless the IAM API is enabled.
Huh, if this is the case could be worth opening a separate issue?
I've been looking into this and I'm not convinced by the Cloud Asset Inventory option, since that API needs to be manually enabled before querying, which in many scenarios (e.g. for auditors) may not be an option.
Is your feature request related to a problem? Please describe.
When scanning organisations with a moderately large number of projects, I often receive 429 status responses from the Service Usage API - it is rate-limited to 240 requests per minute by default. I can see that ScoutSuite is making a large volume of requests to this API - presumably
num projects * num services
requests.It is not possible to increase the project quota above 240 requests per minute without filling out a form to lift the hard limit.
Describe the solution you'd like
The quota limit increase request form mentions Cloud Asset Inventory as more suitable for scanning large numbers of projects:
The Cloud Asset API allows searches of resources across multiple projects, and has a default quota of 600 searches per minute.
Describe alternatives you've considered
An alternative is to fix ScoutSuite to handle and retry 429 responses with exponential backoff. The form continues:
However, because the requests would still be rate-limited, this means completing the scan would take longer than desired.
(Additionally, I believe using this API would simplify granting permissions to permit scanning on GCP, and resolve a separate issue where IAM roles are not scanned on projects unless the IAM API is enabled.)