You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Switch to Packagist api v2 for Composer package metadata #2337
Compose Packagist api v1 is deprecated.
API v2 also handles non-existing packages better, see #2134 And it helps packagist to reduce server load on their end.
Now that we are caching metadata, we could use the If-Modified-Since header to hel preduce load on their server.
In theory also on our end because if the metadata is not modified since we last cached it, we don't have to process the response. But this might be micro optimizing, probably requires a change to the parameters passed into the analyze method and we need to persist the new lastOccurrence timestamp to the database anyway.
changed the title [-]Switch to Packagist api v2 for Compose package metadata[/-][+]Switch to Packagist api v2 for Composer package metadata[/+]on Dec 29, 2022
February 1st, 2025: Composer 1.x metadata will become read-only. No new packages or new versions will be visible for Composer 1.x users after this date.
August 1st, 2025: Composer 1.x metadata access will be entirely shut down. Attempting to update packages using Composer 1.x will no longer work.
When implementing V2 we should consider also getting the Vulnerabity information from the package repository. This will show more vulnerabilities, for example the Drupal advisories which don't have a CVE/GHSA/... identifier.
List security advisories
This endpoint provides a list of security advisories. Either a list of packages as query or request parameter or a timestamp as updatedSince query parameter need to be passed.
When querying with a list of packages, known packages will be included in the response with an empty array if they don't have any listed vulnerability. Package names which are not known to have no vulnerability will not be included at all to show that we do not have data on those.
GET https://packagist.org/api/security-advisories/?updatedSince=[timestamp]&packages[]=[vendor/package]
{
"advisories": {
"[vendor]/[package]": [
{
"advisoryId": "[unique id]",
"packageName": "[vendor]/[package]",
"remoteId": "[deprecated, use sources instead]",
"title": "[title]",
"link": "[url to issue disclosure]",
"cve": "[cve if available]",
"affectedVersions": [affected version in form of a composer constraint]",
"source": "[deprecated, use sources instead]",
"sources": [
{
"name": "[Name of the source where the advisory was found e.g. GitHub or FriendsOfPHP/security-advisories]"
"remoteId": "[A reference to identify the advisory in the source e.g. the GitHub advisory id]"
}
],
"reportedAt": "[date the issue was reported]",
"composerRepository": "[composer repository the package can be found in]",
"severity": [severity if available, following the CVSS3 spec]
}
]
}
}
When implementing V2 we should consider also getting the Vulnerabity information from the package repository. This will show more vulnerabilities, for example the Drupal advisories which don't have a CVE/GHSA/... identifief.
I'd support this idea. Thank you for creating #4465
Implementation-wise, I would go like it currently is: have the base url configurable, so that multiple clients for this API spec could be enabled in DT.
Activity
[-]Switch to Packagist api v2 for Compose package metadata[/-][+]Switch to Packagist api v2 for Composer package metadata[/+]ch8matt commentedon Dec 4, 2024
https://blog.packagist.com/shutting-down-packagist-org-support-for-composer-1-x/
valentijnscholten commentedon Dec 4, 2024
From the blog post:
valentijnscholten commentedon Dec 15, 2024
When implementing V2 we should consider also getting the Vulnerabity information from the package repository. This will show more vulnerabilities, for example the Drupal advisories which don't have a CVE/GHSA/... identifier.
From: https://packagist.org/apidoc#get-package-data:
Working example: https://packagist.org/api/security-advisories/?packages[]=monolog/monolog
In fact, Drupal has its own package repository that DT should index / query as well. And it returns vulnerabilities in the same response as for other package metadata: https://packages.drupal.org/files/packages/8/p2/drupal/mollie.json
I think supported v2 and also supporting vulnerabilities are two separate tasks, so I created #4465 for the vulnerability support.
jkowalleck commentedon Dec 15, 2024
I'd support this idea. Thank you for creating #4465
jkowalleck commentedon Dec 15, 2024
Implementation-wise, I would go like it currently is: have the base url configurable, so that multiple clients for this API spec could be enabled in DT.
see
dependency-track/src/main/java/org/dependencytrack/tasks/repositories/ComposerMetaAnalyzer.java
Line 46 in 45982a2
github-actions commentedon Jan 29, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.