# GitHubAdvisoryCveResolver

> Resolves the CVE identifiers of GitHub security advisories through the GitHub global security advisories API.

[API reference](/docs/api/index.md) › [Foxy](/docs/extensions/foxy/reference/index.md) › [Audit](/docs/extensions/foxy/reference/audit/index.md) › GitHubAdvisoryCveResolver

| final readonly class | `Foxy\Audit\GitHubAdvisoryCveResolver` |
| --- | --- |
| Implements | [`CveResolverInterface`](/docs/extensions/foxy/reference/audit/cveresolverinterface/index.md) |
| Source | [`src/Audit/GitHubAdvisoryCveResolver.php`](https://github.com/php-forge/foxy/blob/main/src/Audit/GitHubAdvisoryCveResolver.php#L28) |

Resolves the CVE identifiers of GitHub security advisories through the GitHub global security advisories API.

The lookups run concurrently, so the downloader must be the async-enabled instance returned by
`Composer::getLoop()->getHttpDownloader()`; any other instance throws a `LogicException` on the first request.

See also: <https://docs.github.com/en/rest/security-advisories/global-advisories>.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`__construct()`](#method-__construct) | Creates a resolver using Composer's asynchronous HTTP downloader. | `GitHubAdvisoryCveResolver` |
| [`resolveMany()`](#method-resolveMany) | Resolves the CVE identifiers of several advisories with one concurrent request per identifier. | `GitHubAdvisoryCveResolver` |

## Method details

### __construct() <span id="method-__construct"></span>

```php
public function __construct(Composer\Util\HttpDownloader $httpDownloader)
```

Creates a resolver using Composer's asynchronous HTTP downloader.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$httpDownloader` | `Composer\Util\HttpDownloader` |  |

### resolveMany() <span id="method-resolveMany"></span>

```php
public function resolveMany(list<string> $ghsaIds): array<string, Foxy\Audit\CveResolution|Throwable>
```

Resolves the CVE identifiers of several advisories with one concurrent request per identifier.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$ghsaIds` | `list<string>` | GHSA identifiers to resolve, trimmed and compared case-insensitively. |

**Returns**

`array<string,` [`CveResolution`](/docs/extensions/foxy/reference/audit/cveresolution/index.md)`|`[`Throwable`](https://www.php.net/manual/en/class.throwable.php)`>`: Resolutions keyed by canonical GHSA identifier; a `Throwable` is the transport, JSON, or document error of that lookup.

**Throws**

- [`Foxy\Exception\RuntimeException`](/docs/extensions/foxy/reference/exception/runtimeexception/index.md): if an identifier is not a GHSA identifier; nothing is requested in that case.