Problem/Motivation

In #3316617: Add a validator to check that PHP-TUF's Composer integration is present and configured correctly we are adding a validator that ensures PHP-TUF support is present in the site's Composer configuration. However, the validator is not actually tagged as an event subscriber, so it's dormant code.

Several things have to happen for TUF to be activated on a Drupal site (most need child issues):

  • The PHP-TUF Composer plugin needs to be present and installed as a dependency. (This likely necessitates tagging stable releases of both the plugin and the underlying PHP-TUF library.)
  • The plugin also has to be listed in Composer's allow-plugins config. That's being done for new sites by #3522991: The project templates should allow the PHP-TUF plugin, but existing sites will need to either run a Composer command, or we'll need to write an update or install hook that modifies the project-level composer.json.
  • The packages.drupal.org repository has to be explicitly opted into TUF. That's also done in composer.json and will either need to be set for new sites right off the bat, or we'll need an update/install hook to do it.
  • Some recent root metadata for drupal.org's TUF repository has to be in PROJECT_ROOT/tuf/packages.drupal.org.json. We'll need to ship this for new and existing projects -- a scaffold file is probably the correct approach. This is most likely best done when we're nearing a stable release of Package Manager in core.
  • Core needs to mark the PHP-TUF validator in Package Manager as active (i.e., tag it as an event subscriber).

Proposed resolution

Tag the validator as an event subscriber, and add a hard dependency on php-tuf/composer-integration to Package Manager.

Remaining tasks

Postponed on:

  1. https://github.com/php-tuf/php-tuf/issues/385 (closed) which should be resolved by https://github.com/php-tuf/php-tuf/pull/387 (merged) and https://github.com/php-tuf/php-tuf/pull/386 (merged)
  2. #3370270: [PP-1] Add php-tuf/composer-integration to core dependencies
  3. #3316617: Add a validator to check that PHP-TUF's Composer integration is present and configured correctly
  4. drupal.org deploying TUF support to packages.drupal.org in #3325040: [Packaging Pipeline] Securely sign packages hosted on Drupal.org using the TUF framework and Rugged
  5. https://github.com/php-tuf/composer-integration/issues/127 (closed)
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

phenaproxima created an issue. See original summary.

wim leers’s picture

Title: [PP-1] Require PHP-TUF's Composer integration plugin » [PP-2] Require PHP-TUF's Composer integration plugin
Issue summary: View changes
Priority: Normal » Critical
Issue tags: +alpha-target, +core-mvp
Related issues: +#3325040: [Packaging Pipeline] Securely sign packages hosted on Drupal.org using the TUF framework and Rugged, +#3316617: Add a validator to check that PHP-TUF's Composer integration is present and configured correctly

Given Drupal core release managers have indicated this is a hard requirement … updating issue metadata accordingly.

This is AFAICT hard-blocked on #3325040: [Packaging Pipeline] Securely sign packages hosted on Drupal.org using the TUF framework and Rugged too. Once #3316617: Add a validator to check that PHP-TUF's Composer integration is present and configured correctly lands, this will be down to PP-1.

wim leers’s picture

Title: [PP-2] Require PHP-TUF's Composer integration plugin » [PP-1] Require PHP-TUF's Composer integration plugin
Assigned: Unassigned » phenaproxima
phenaproxima’s picture

Not until PHP-TUF (both the library and the plugin) are published on Packagist.

wim leers’s picture

Right, but I mean an outline of a MR that shows which code would need to change. While it's still fresh in your head.

I would not expect this MR to pass obviously!

wim leers’s picture

Assigned: phenaproxima » Unassigned

Splendid! 🤩

Thanks 😊

wim leers’s picture

Issue tags: -alpha-target +alpha target
catch’s picture

Title: [PP-1] Require PHP-TUF's Composer integration plugin » Require PHP-TUF's Composer integration plugin
Status: Postponed » Needs work
Issue tags: +package manager alpha blocker

https://packagist.org/packages/php-tuf/ should mean this is unblocked?

catch’s picture

Project: Automatic Updates » Drupal core
Version: 3.0.x-dev » 11.0.x-dev
Component: Code » ajax system

Moving to core.

catch’s picture

Component: ajax system » package_manager.module
catch’s picture

I think this still might only be partially implemented in package_manager - we need to figure out exactly what's left to do here.

quietone’s picture

Version: 11.0.x-dev » 11.x-dev
larowlan’s picture

cmlara’s picture

Title: Require PHP-TUF's Composer integration plugin » [PP-1] Require PHP-TUF's Composer integration plugin
Status: Needs work » Postponed
Related issues: +#3477553: [PP-1] Manually test TUF-enabled Composer projects

Setting as postponed on upstream https://github.com/php-tuf/composer-integration/issues/127

As discovered in #3477553: [PP-1] Manually test TUF-enabled Composer projects in even basic lab deployments the plug-in causes an excessive increase in memory consumption.

catch’s picture

Issue summary: View changes

That should be resolved by https://github.com/php-tuf/php-tuf/pull/386 and https://github.com/php-tuf/php-tuf/pull/387 - manual testing of those MRs (or in general if there's a new release incorporating them) would be very welcome. Updating the issue summary to link to them.

phenaproxima’s picture

Spun off #3522991: The project templates should allow the PHP-TUF plugin as a Package Manager beta blocker to save us some pain later.

phenaproxima’s picture

Issue summary: View changes
catch’s picture

Title: [PP-1] Require PHP-TUF's Composer integration plugin » Require PHP-TUF's Composer integration plugin
Status: Postponed » Active

https://github.com/php-tuf/php-tuf/pull/395 landed.

#3477553: [PP-1] Manually test TUF-enabled Composer projects is still open, but if the dependency is in core, that is one less testing step.

larowlan’s picture

quietone’s picture

Issue summary: View changes
Status: Active » Postponed

This is postponed on 3 php-tuf issues and 1 core issue, so changing status. Update the issue to put the postponed items into the remaining tasks per the guidelines.

naheemsays’s picture

Is this still postponed on anything?

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

star-szr’s picture

I think this is still postponed on #3370270: [PP-1] Add php-tuf/composer-integration to core dependencies, which is postponed on #3579174: [meta] Diagnose issues related to TUF-enabled projects. It's hard to confidently test the tooling with the current metadata issues.

ergonlogic’s picture

Issue summary: View changes

Updated status of related Github tickets.

ergonlogic’s picture

Issue summary: View changes

Added blocker on php-tuf/composer-integration#127

catch’s picture

https://github.com/php-tuf/composer-integration/issues/127 had some work one on it already, I haven't profiled since my last update on there though and can't remember where it got to. It might be that the memory overhead is low enough that it shouldn't block, at least not inclusion for testing.

For general package_manager performance, #3534109: Permanently maintain a sandbox directory in package_manager is likely to have a lot more impact.

ergonlogic’s picture

Re. #127, specifically, we plan to profile against the current codebase, then again against a checkout prior to the work that's been merged over the past few months. That should give us a baseline to determine whether additional work in #127 is warranted.

We're also planning to work on #3534109: Permanently maintain a sandbox directory in package_manager, but I think that might be more of a blocker for #3331078: Add php-tuf/composer-stager to core dependencies — for experimental Automatic Updates & Project Browser modules, rather than this issue.

cmlara’s picture

A suggestion was previously made to adopt FAIR: https://git.drupalcode.org/project/infrastructure/-/work_items/3580895. I'm not sure why that issue was made an infra ticket when really the whole point of FAIR would be a non-dependence on D.O. infra. That should play into discussions here on if PHP-TUF is the best choice available. I'm not sure FAIR is necessarily any more or less mature than PHP-TUF.

ergonlogic’s picture

I haven't read into FAIR all that deeply, but AFAICT, adopting FAIR would mean dropping Composer altogether (and everything that implies), which is outside the scope of this ticket, imo.

Also, according to its [security docs](https://github.com/fairpm/fair-protocol/blob/main/docs/security.md#secur...), FAIR seems to assume some kind of package signing by the repository itself. This is closer to PHP-TUF's role in addressing the [various attack vectors](https://theupdateframework.org/docs/security/) that the TUF Spec was designed to protect against.

cmlara’s picture

which is outside the scope of this ticket, imo.

I believe the scope of this ticket is including PHP-TUF for use by project browser and automatic updates as a secondary security measure on top of composer.

If those modules were migrated to FAIR TUF may become moot.

FAIR seems to assume some kind of package signing by the repository itself

Indeed. I believe it was intended to be a secure distributed supply chain. We would need to understand the signing protocol to understand if TUF is relevant in that environment.

FAIR would mean dropping Composer altogether

From what I understand from Typo3 they are implementing FAIR and keeping composer as an option (at least for now) with FAIR possibly creating a custom repository type in the future to be a part of composer. Yes FAIR was originally envisioned as a package manger for Wordpress which did not generally use composer for management so it does have a different design.

If your not using any of the fancy Project Browser or Auto Update features that is a reasonable deployment for most sites since TUF to my knowledge is not providing any mentionable protection above what already exists with D.O. composer deployments.

star-szr’s picture

Issue summary: View changes