Download the PHP package ruvelo/security-advisories without Composer
On this page you can find all versions of the php package ruvelo/security-advisories. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ruvelo/security-advisories
More information about ruvelo/security-advisories
Files in ruvelo/security-advisories
Package security-advisories
Short Description The framework-agnostic core behind Ruvelo's security alerts: reads lockfiles, matches advisories from Valtry's signed API or Packagist and OSV directly, marks what CISA KEV says is exploited, and tells you what changed.
License MIT
Homepage https://github.com/Ruvelo/security-advisories
Informations about the package security-advisories
Security Advisories
The core behind Ruvelo's security alerts for Laravel, Symfony, Shopware, PrestaShop, Joomla and more. It reads a project's lockfiles, asks Packagist and OSV which installed versions are vulnerable, marks what CISA says attackers are exploiting, and works out what changed since last time. No framework, no storage, no notifications: those belong to the platform modules built on it, so a fix here reaches all of them.
You also need a PSR-18 client and PSR-17 factories. If your app has Symfony HttpClient or Guzzle, you have one; otherwise composer require symfony/http-client nyholm/psr7.
Usage
Scanner::forProject() takes a JsonClient if you want to pass your own PSR-18 client and factories (new JsonClient($client, $requestFactory, $streamFactory)); without one, php-http/discovery finds them.
What it gives you
| Class | What it is |
|---|---|
Scanner |
scan(bool $fresh = false): Report. Never throws for a missing file or a failing feed. |
Report |
Immutable. findings (worst first), counts(), worst(), exploited(), failing($t), failsOn($t), isClean(), isComplete(), problems, unchecked (packages no source covers: an inventory, not a problem), notes (non-fatal remarks), toArray() / Report::fromArray(), source (valtry, public or mixed) and sources per ecosystem, toArray() / JSON. |
Finding |
Immutable. Package, installed version, advisory id, title, link, CVE, Severity (including NotRated), fixedIn, exploited (a KevEntry with dates added and due, and ransomware use), isDev, and a stable key(), aliases, links, the installed package's metadata, and toArray() / Finding::fromArray() in a versioned shape (v). |
Reconciler |
reconcile($known, $report, $lastSeen = []): Changes, next($known, $report, $unacknowledged = []) and lastSeen(). Stores nothing. An incomplete report never resolves anything; unacknowledged keys stay news until delivered. |
Versions |
affects() and fixedIn() on composer/semver. Follows patch lines and minor-split ranges; says >2.10.1 when an advisory only names the last affected release. |
Data sources
By default a scan asks Valtry first and the public feeds whenever Valtry can't answer. Both paths give the same findings: Valtry serves the same Packagist, OSV and CISA KEV data, normalised, from one request per ecosystem.
| Path | Used for | What leaves your server |
|---|---|---|
| Valtry Advisory API (default) | Composer and npm packages, and whether each advisory is exploited (CISA KEV) | Package names only, and a random nonce. Never versions: they are matched locally with composer/semver. |
| Packagist (fallback, or opted out) | Composer packages | Package names only. Versions are matched locally. |
| OSV.dev (fallback, or opted out) | npm packages | Names and exact versions of npm packages, then advisory ids. |
| CISA KEV (fallback, or opted out) | Exploited in the wild | Nothing: the whole catalogue is downloaded. |
Valtry doesn't log or store the names it is sent, or pair them with your address. Its privacy terms are on the API page.
Signed answers. Every Valtry answer carries an Ed25519 signature (X-Valtry-Signature: ed25519=…; kid=…) over its exact body. The library verifies it against public keys pinned in src/Valtry/Keys.php, never against a key it downloads, and checks that the answer echoes the request's nonce and covers every name asked about. A hijacked DNS record, a TLS-intercepting proxy or a replayed old answer fails those checks. Verification needs ext-sodium, which PHP bundles.
Fallback. For each ecosystem, the public feeds answer instead when Valtry:
- can't be reached, or takes longer than 5 seconds;
- answers with an error (any status but 200, including 429 and 5xx);
- sends an answer that doesn't verify: a bad or missing signature, an unknown key, another request's nonce, or missing packages;
- says its own data for that ecosystem is stale (a feed behind it missed its sync window).
After a network failure, an error or a bad signature, Valtry is left alone for five minutes (in your PSR-16 cache, if you pass one). $report->source says which path answered (valtry, public, or mixed when they differed), and $report->sources has it per ecosystem. An ecosystem never gets half an answer from each.
The 5 seconds are enforced by the HTTP client: without a client of your own, the library builds one with that timeout from Symfony HttpClient or Guzzle when either is installed; a Symfony Psr18Client you pass gets a copy with the timeout. With another client, give it a short timeout yourself: an answer that arrives late is still discarded, but only after it arrives.
Fail-closed until a key is pinned. While Keys::PINNED holds a placeholder, the Valtry path sends nothing and every scan uses the public feeds. CI refuses to build a tag with a placeholder left. To pin the key, run php artisan advisories:keygen on Valtry, paste the printed 'kid' => 'base64', line into Keys::PINNED, release, and only then switch Valtry to the new key. To rotate keys, add the new kid beside the old one, release, switch Valtry, and drop the old kid a release later.
Opting out. To never contact Valtry, pass source: 'public':
or set RUVELO_ADVISORIES_SOURCE=public in the environment. The environment variable wins over code, so a server's owner can opt out without touching an adapter's configuration.
Everything goes through the PSR-18 client you give it, and is cached with PSR-16 if you pass a cache (advisories one hour, KEV six hours, OSV details one week; change them with Ttls). No keys, no accounts, no other requests.
Extension points
- Another HTTP client: any PSR-18 client with PSR-17 factories, through
JsonClient(Http\CurlClientif the platform has none). Timeouts and redirects are the client's settings (see the 5 seconds above for Valtry). - Another primary source:
FallbackAdvisorySourcetakes anyAdvisorySourcefirst and a list of fallbacks, and reports which answered throughReportsOrigin. - Another cache: any PSR-16 cache, through
Scanner::forProject(cache: ...)orResponseCachefor the individual sources. - Extension inventories: implement
PackageSource, or pass a list toExtensionList(Joomla extensions, PrestaShop modules, Shopware plugins). Packages that are also Composer packages useEcosystem::Composerand Packagist covers them. - Another advisory feed: implement
AdvisorySource(supports()andfind()) and give it tonew Scanner($packageSources, $advisorySources, $exploits). ThrowSourceUnavailablewhen the feed can't be read in full, and the report says so instead of looking clean. - Another exploited list: implement
ExploitCatalogue.
Options for adapters
- Unchecked packages. An inventory entry whose ecosystem no source covers is listed in
$report->unchecked(with the reason), and doesn't affectisComplete(). Only a source that fails does that. - Notes. A source that also implements
Sources\EmitsNotesreturnsNotes after eachfind()(new Note('Affected versions unreadable, check by hand.', Ecosystem::Extension, 'acme/plugin', $url)); they land in$report->notesand never block resolving. - Same vulnerability, two sources. The Scanner keeps one finding per package and vulnerability (same id, CVE or an overlapping alias): the source with exact ranges wins, aliases and links are merged and "exploited" is kept if either has it. Give
Advisoryitsaliasesso overlaps are found. - Persisting.
$finding->toArray()/Finding::fromArray()and$report->toArray()/Report::fromArray()are versioned (v) and read what 1.0 stored. Together with the Reconciler'snext()andlastSeen()that is all an adapter needs to store. - Package metadata.
new InstalledPackage($ecosystem, $name, $version, metadata: ['active' => false, 'source' => 'zip'])(or ametadatakey in anExtensionListarray) arrives unchanged in$finding->metadata. - Text feeds.
$json->getText('Friends of Presta', $url)returns the body as a string;ResponseCache::rememberText()caches it. - No HTTP client, no cache?
new JsonClient(new Http\CurlClient())needs only ext-curl (and PSR-17 factories), andnew Cache\FileCache($dir)is a PSR-16 cache in a directory.
Writing an adapter
An adapter is a platform's glue: it knows what is installed, where to store results and how to tell people. The core does the rest.
- Inventory. Turn the platform's extension list into
InstalledPackages (anExtensionList). UseEcosystem::ComposerorEcosystem::Npmfor what Packagist or OSV cover,Ecosystem::Extensionfor the rest, andmetadatafor what you want to show later. - Advisories. For a platform feed, implement
AdvisorySource(supports(),find()): returnAdvisoryMatches for the exact versions, fillaffectedVersionswhen you can read the ranges, and throwSourceUnavailableif the feed can't be read in full. ImplementEmitsNotesto flag what you couldn't judge. - Scan.
Scanner::forProject($root, ecosystems: [...], extraSources: [...], extraPackageSources: [...]), ornew Scanner(...)when there is no lockfile. Pass your platform's PSR-18 client and PSR-16 cache throughJsonClientandcache:, or the built-inCurlClientandFileCache. - Decide. Show
$report->findings; tell people when! $report->isComplete()(problems), and listuncheckedandnotesapart from findings. - Remember. Store
$reconciler->next(...),lastSeen(...)and the report'stoArray(), reconcile on the next run, and notify onChanges::$newandChanges::$exploited.
Development
composer check runs code style (Pint, PSR-12), static analysis (PHPStan level 8) and the tests, exactly as CI does. The tests never touch the network: a mock PSR-18 client serves real recorded responses from tests/fixtures. See changelog.
Credits
Built by François Bultez at Valtry, the website security scanner, and everyone who contributes.
Advisories come from Valtry, Packagist (and through it the GitHub Advisory Database and FriendsOfPHP/security-advisories), OSV.dev and CISA. Thanks to everyone who maintains them.
License
MIT. See LICENSE.
All versions of security-advisories with dependencies
composer/semver Version ^3.4
php-http/discovery Version ^1.19
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1|^2.0
psr/simple-cache Version ^3.0