Repository navigation
feat!: move to the v3 API and tighten the connection - #3
Merged
Merged
Conversation
The client calls /api/v3. It refuses redirects and plain http to other computers, sends a scan or delete only once, keeps the key out of printed objects and away from .netrc, and reads VULNRADAR_TOKEN like the command line tool does. Errors carry the server's code and request id, each rate limit is named, and every network failure is an SDK error. Scans on v3 run in the background and this does not follow them yet, so a reply that is not a finished result now raises instead of reading as a scan with no findings.
A base_url without a path made version() send the key to a host named "version", and a proxy from the environment would have received plain http requests to this computer. Both are closed. Deeply nested or impossible values in a reply now raise SDK errors, and a network error no longer carries the request that holds the key.
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.
Builds on #2. The releases call API versions that no longer exist; this moves the client to
/api/v3and rebuilds the layer that talks to it.Connection:
base_urlmust usehttpsand include the API path; plainhttpis for this computer only and skips any proxy.Retry-Afterup to 30 seconds. A scan or delete is sent once..netrc, and is not attached to network errors.VULNRADAR_TOKENandVULNRADAR_API_BASEare read like the command line tool reads them.Errors:
Retry-Afterand reply body.RateLimitError.kindsays which limit was reached, for both the 3.9.2 and 4.0 reply formats.Not working yet: scans on v3 run in the background.
scan()andscan_crawl()start one and then raiseUnexpectedResponseErrorwith its id, so an unfinished scan is never reported as clean.history.list()raises too, because ids are now text. Following scans and reading history are the next two changes.Breaking changes are listed in the changelog.
Tested locally on Windows: the 179 offline tests pass on Python 3.11 and 3.13, and ruff and
mypy --strictpass on 3.13. Before the last commit, ruff, mypy and the tests also passed on 3.11, 3.12 and 3.13 from a clean copy, with the build, an install using the oldest allowed versions and a dependency audit. Nothing was run against a live server with a real key.