Provide security-advisories API endpoint

Created on 7 November 2023, about 1 year ago
Updated 20 February 2024, 10 months ago

Problem/Motivation

Currently packages.drupal.org only reports security advisories for packages under the respective p2/[package-name].json endpoints. Additionally a security advisories endpoint should be implemented that allows easy retrieval of information about security advisories without having to fetch the full metadata for all packages one is interested in. In particular it also provides a mechanism to retrieve all advisories since a previously checked timestamp to make sure one finds all newly reported advisories immediately.

Packagist.org's packages.json advertises this endpoint as such:

security-advisories: {
    metadata: true,
    api-url: "https://packagist.org/api/security-advisories/",
    query-all: true
},

Documentation for the endpoint is available at https://packagist.org/apidoc#list-security-advisories

Without this endpoint reporting security advisories in p2 endpoints for packages not actually provided by packages.drupal.org is unreliable and may even be considered a bug and made impossible in future Composer versions. These types of advisories should be published with the security-advisories API endpoint with "query-all: true".

For example currently the endpoint https://packages.drupal.org/files/packages/8/p2/drupal/core.json reports security advisories for the drupal/core package that is not installed from packages.drupal.org and no other package metadata is provided. Now, if a user has a different custom/higher priority repository defined, e.g. a direct git repository installing this package, then composer update would never even attempt to download the advisories data from the p2 endpoint, and the user wouldn't get notified about these advisories. When using the security-advisories endpoint with query-all: true, Composer would still check the drupal repository for advisories for this package.

The security-advisories endpoint both allows retrieving a list of advisories for a selected set of packages and since a particular timestamp. The need for the latter in proxying/mirroring Composer repositories like https://packagist.com would already be reduced by implementing a changes feed, see https://www.drupal.org/project/project_composer/issues/3399867 โœจ Provide metadata/changes.json endpoint to track updates Needs review which could then report an update for a package any time its list of advisories changes. This would however still mean that only advisories for packages installed through the proxy/mirror could get advisories noticed, allowing retrieval of all advisories would still be prefered over having to read all metadata for all packages on a regular basis to find out about new advisories.

Proposed resolution

Implement a security-advisories API endpoint.

โœจ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฉ๐Ÿ‡ชGermany naderman

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024