Repository navigation
feat!: follow background scans and read the v3 results - #4
Merged
Merged
Conversation
scan() and scan_crawl() now start the job, poll it and return the finished result. client.scans starts, reports, waits for and cancels scans. An unfinished or failed scan raises, so it can never read as a clean one. Results and findings match what the server sends, keep unknown fields in raw, and show what was not checked or was marked a false positive. An unfamiliar severity is "unknown" instead of "info". Scanner names are checked before sending, because older servers run nothing for a misspelt one. Targets without a scheme are accepted.
Servers before 4.0 do not mark a scan incomplete when checks fail to run, or a crawl incomplete when the quota cuts it short, so the SDK adds those marks itself. Waiting for a scan now makes one request per poll and gives none longer than the time left. Targets with a scheme later in the address or with surrounding blanks are accepted, summary counts that are not numbers are an error, and the default wait outlasts the server's crawl limit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scans on the v3 API run in the background. Until now
scan()andscan_crawl()started one and then raised. This follows them to the end.scan()andscan_crawl()start the job, poll it and return the finished result.client.scansstarts, reports progress, waits for and cancels scans.raw.incompletelists what was not checked, including two cases 3.9.2 does not report itself: checks that failed to run, and a crawl cut short by the quota.unknowninstead ofinfo.Breaking changes are in the changelog. Reading the history list is the next change;
history.list()still raises.Tested locally on Windows with Python 3.11, 3.12 and 3.13: 267 offline tests pass, ruff and
mypy --strictpass on 3.13, and the README examples type check. The tests build their replies from the server source; nothing was run against a live server, so the live tests are not run.