-
Notifications
You must be signed in to change notification settings - Fork 8
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
Bulk scan error handling #1126
Bulk scan error handling #1126
Conversation
See documentation: https://docs.docker.com/compose/compose-file/04-version-and-name/#version-top-level-element-obsolete > The top-level version property is defined by the Compose > Specification for backward compatibility. It is only informative and > you'll receive a warning message that it is obsolete if used. I've removed this to prevent us from getting the following warning when docker compose commands are run: ``` WARN[0000] docker-compose.yaml: `version` is obsolete ```
Updates the asset scanner/fetcher to catch any exceptions the `requests` library raises when attempting to obtain the contents of various asset files. The previous behavior was to let those be raised. I've changed the `fetch_asset` function, the only place where we invoke `requests`, to return a string containing the text content of the response, rather than the response itself. This is a good change anyway, since it means the callers of `fetch_asset`, all of which only wanted the text content anyway, don't have to worry about the details of the `requests` library. One thing to note: if an error is caught, then the function returns the empty string. This is the simplest thing to do, but it means we're kind of passing over the error. If we want to flag it in the results somehow, then we will have to add some additional code and make decisions about how exactly we want that to work.
If an error occurs while conducting a bulk scan, skip the landing page currently being scanned and continue with the rest of the ones in the queue.
try: | ||
current_result = perform_scan(entry.landing_page_url, permitted_domains) | ||
except Exception: | ||
continue |
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.
I am slightly worried about this failing too silently. Should we maybe have a warning of some sorts logging the error, in case there is some real error that we may need to debug?
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 mostly good to me. Left a small comment, but I don't think that is a blocker for getting this PR merged and deployed. Let's test it on staging.
Description
Fixes #1125
Changes proposed in this pull request:
This PR adds some error handling to the scan process in two ways:
See commit messages for additional technical details.
Type of change
Testing
I've added unit tests for both changes, but it might be useful to try this locally with a bulk scan on the problematic landing page that inspired this issue.
Post-deployment actions
None.
Checklist
General checks
If you made changes to scanner
/api/v1/directory
returns directory entries and scan results as expected