-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve handling of quota limit reached errors #610
Improve handling of quota limit reached errors #610
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor remarks, looks good. I like the new AbstractGGAPIHandler 👍🏻.
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #610 +/- ##
==========================================
+ Coverage 93.84% 93.85% +0.01%
==========================================
Files 104 104
Lines 4844 4853 +9
==========================================
+ Hits 4546 4555 +9
Misses 298 298
Flags with carried forward coverage won't be shown. Click here to find out more.
|
When quota limit is reached ggshield: - prints this error: "Could not perform the requested action: no more API calls available." - exits with an error code of 128 - does not print anything through the output handlers (no text report, no JSON report)
4f0ccbc
to
10fef6f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
closes #309
Problem
The output of ggshield when the quota limit is reached can be confusing:
Even more with the JSON output:
The error code is 0, and ggshield say that no secret have been found, when no file have been scanned.
Solution
I've added an exception
QuotaLimitReachedError
which is raised bySecretScanner._collect_results
when ggshield receives a 403 with the messageQuota limit reached.
. This exception is then passed all the way to up andscan_commit_range
has been updated to stop as soon as an exception occurs.The new output is:
The output handler is not called and the exit code is 128.
It also stop a large scan if the error happens in the middle of the scan:
The PR also include a small commit to fix the a version specifier in the Pipfile. My version of pipenv didn't like the missing
==
.