Audit APIο
Warning
This feature is experimental and subject to breaking changes. See the Conan stability section for more information.
Warning
Subapis must not be initialized by themselves. They are intended to be accessed only through the main ConanAPI attributes.
- class AuditAPI(conan_api)ο
This class provides the functionality to scan references for vulnerabilities.
- static scan(deps_graph, provider, context=None)ο
Scan a given recipe for vulnerabilities in its dependencies.
- Parameters:
deps_graph β Dependency graph as returned by the
Graph APIprovider β Provider object as returned by
get_provider()context β Context to filter the dependencies (e.g.,
"host"or"build"). IfNone, all contexts are considered.
- Returns:
A
dictmapping each scanned reference to its vulnerability information, together with some metadata about the request, with the following shape:{ "data": { # One entry per scanned reference "openssl/3.2.0": { "vulnerabilities": { "totalCount": 2, # One "node" per vulnerability, holding its name, # description, severity, cvss, references, # advisories, fixed versions, etc. "edges": [{"node": {...}}, ...] } }, # References that could not be scanned carry an error instead "unknown/1.0": {"error": {"details": "Package 'unknown/1.0' not scanned: Not found."}}, }, # URL of the provider that produced the data, or None "provider_url": "https://...", # Only present if the whole request failed (authentication, # rate limit, server error...). When set, the scan is aborted. "conan_error": "...", }
- static list(references: List[str], provider)ο
List the vulnerabilities of the given reference.
- Parameters:
references β List of reference strings
provider β Provider object as returned by
get_provider()
- Returns:
A
dictwith the vulnerability information for each reference, with the same structure as the one returned byscan().
- get_provider(provider_name: str)ο
Get the provider opaque object by name. This object is only meant to be used as arguments for other methods in this class, and should not be used/modified directly.
- Parameters:
provider_name β Provider name
- Returns:
Provider opaque object
- list_providers()ο
Get all available providers.
- Returns:
The list of available providers
- add_provider(name: str, url: str, provider_type: str)ο
Add a provider.
- Parameters:
name β Provider name
url β Provider url
provider_type β Provider type, either
conan-center-proxyorprivate
- remove_provider(provider_name: str)ο
Remove a provider.
- Parameters:
provider_name β Provider name
- auth_provider(provider, token: str)ο
Set authentication token for the provider. Note that this does not perform an authentication attempt, it just stores the token for future use.
- Parameters:
provider β Provider name
token β Provider token