Skip to content
Adam edited this page Mar 27, 2023 · 34 revisions

Notes

Currently, the only key type supported by PHP-TUF is ed25519 (elliptic-curve). See https://ed25519.cr.yp.to/

Resources

AutoUpdater

"Lazy Mirror" architecture: Feb 5, 2021

TUF Maintainer + PHP-TUF Team

Knowledge Share #1: Jan 15, 2021

Recap:

  • Trying to understand how to properly manage TUF validation for packages and metadata discovery for the Drupal specific use case, and want to compare this to how Python/PIP is implementing this.
  • Some considerations in the PHP/Drupal space:
  • Because Composer 2 does not yet support TUF signing or validation, our proposal is to:
    • Write a Composer plugin which replaces the httpd download process which currently validates with TLS, and instead validate via TUF
    • However, in order to provide signatures and validation for the third party packages (from Packagist) we have to create our own lazy mirror of the packagist end-point and TUF sign it ourself.
    • To do that, we need to mirror TUF metadata, and refresh that mirror based on the atom-feed updates from Packagist.
  • Per @TrishankatDataDog - this closely matches PEP 458
    • Some considerations:
      • When doing a lazy-mirror need to make sure the different pieces of packages.json metadata don't get out of sync with each other.
        • Using a singular worker in the queue for the freshening
        • We can't get an atomic snapshot from packagist - but we can start with leaf data and pull up to the root last during the update. Worst case, any dsync would break rather than provide insecurity (but really need to think this through more)
        • Need to consider how packages depend on each other:
          • Time 1 - Packages A and B - our mirror reflects that
          • Time 2 - Package A and B both update, but if our mirror is single worker, it may update A, and then be caught before updating B
      • Probably would need to consider marking our mirror 'dirty' and then queueing a catch up process to regain consistency with the tip of Packagist changes.
      • Consider exploring TUF 'map' files, no example in reference implementation, but may be helpful for enforcing an order of dependency resolution.
        • You can say use these to say - once you've looked for this in the Drupal namespace, do not fall back to any other namespace
  • Per @tedbow - want to understand how delegations created in spec section 5.4.5 are downloaded, it isn't really explicit in the spec definition
  • Per @dts - We'd like to offer our conformance suite proposal to become part of the TUF organization itself, and ultimately do the same with the full php-tuf implementation. If we can confirm that we've written it enough to spec to be accepted, that will go a long way towards encouraging Composer/Packagist to accept this implementation and adopt it.
    • @TrishankatDataDog: In favor, but of course have to talk with the whole team - let's regroup in the channel.

Recording:

PHP-TUF contribution meeting and sprint history

Sprint 4: Dec 28-Jan 6, 2021

Recap

  • Checking with TUF project reps about signing and validation of meta-data vs. just signing and validating the downloads.
  • Only one outstanding pull request, which @tedbow is reviewing.
  • @drumm: Still in the planning phase for server-side - but waiting on the understanding about the signing and validation of meta-data per above.
    • General consensus, it's never possible to have absolutely everything signed (custom repositories and custom code)
    • Questionable whether we provide signatures for third party dependencies even as a proxy - provides one level of confidence, but not control over those releases in their actual source.
  • We are now agreed that signing even the third party libraries is essential to preserving the 'last mile' of the trust chain - however, we need to communicate what and why we're doing very carefully. We're not taking over the integrity of any project owner's release process, it's about the integrity of the distribution chain. (For example, using symfony, there is precedent for 'secondary signatures': https://koji.fedoraproject.org/koji/buildinfo?buildID=1634309 <-- redhat signs symfony packages as part of distribution chain)
  • When it comes to the actual transport, we debated an event based vs an HTTP downloader that can directly substitute tuf for tls essentially - and are leaning heavily towards the HTTP downloader solution.
  • Consensus on: Light mirror technique for providing signatures of third party packages:
    • Accepts requests as if to packagist
    • If it doesn't have it, enqueues a job to get from packagist and sign it, and set up a freshening process to keep it updated
    • Then able to offer from the light-mirror
    • Not limited to Drupal-specific
  • Re: actually using PHP-TUF together with Composer - two problem spaces:
    • @mbaynton and maybe now @tedbow have been looking at the actual HTTP downloading to respect TUF and specific roots
    • @effulgentsia has been looking at the actual application of the updates, and the logic of what to update and what to block updates on. (exclusion lists, etc)
      • @dts - perhaps defining an .htaccess like file for this for directory understanding/exclusion lists/etc
      • On the subject of namespacing: For now, using personal namespaces for proof of concept is fine, ultimately lets put more final versions under the php-tuf namespace (but separate repo) - and consider later if we want to put under a Drupal specific namespace (for now, we're still creating essentially generic useful PHP code)

Next steps:

  • Finalize the question about meta-data signing
  • Regroup with @effulgentsia about signing targets/providing signatures for third party dependencies.
  • Composer plugin work - some work can be done, but will also run into the blocker on what is being signed.

Discussion session recordings

Meeting minutes

TBA

Sprint 3: November 10-14, 2020

Recap

Discussion session recordings

Meeting minutes

Agenda Nov. 13 - server side

  • Neil: Do I remember - is Typo3 going to do the package signing on the server side for delivery, or the signing
    • Benni: We do have release managers doing individual signing, but we would want signed delivery artifacts as well
    • Benni: question - are we talking about signing tar.gz and .zip or just the Composer side?
      • We want php-tuf to be agnostic to what it is signing
      • However Drupal's use-case will be primarily be at least 50%+ Composer usecase
    • Benni: The whole Composer thing may ultimately be more complicated because of the third party libraries
      • But in general - focus on signing the first-party tar.gz and zip files - and then do zip files afterwards.
      • However the Composer plugin method for validating packages
        • Eventually we would really love to have this go upstream.
        • PHP-Tuf can keep work for independent use-cases - and hopefully Composer adopts and handles some third parties
        • In the meantime, we might send a packagist proxy - but that's not something we won't have to maintain long term
          • Benni:
            • Did you ever look into the packagist proxy stuff?
            • I've worked with Packagist API - but not sure what would need to be changed to build
          • David:
            • Looked into the lambda repository roll-up with a proxy - less confident in ability to sign with a proxy.
            • Without breaking the spec and have clients send hints to the server, it looks hard to do on-demand lazy signing of third party.
            • We could look at mirroring the packagist data or meta-data and signing - technically we should probably signing both. Could proxy the file content itself - and cache that - without having to keep the zips…
            • Either way, we need to know the hashes of the zips in the repos to publish
            • It may be possible to use the API to get the initial packagist data for all packages - and then freshen the local metadata proxy/mirror/thing
  • First party signing implementation for server-side:
    • Benni:
      • The doable part for us is to have it working for our zipfile strategy
        • Just plain zip files not Composer delivered.
          • David: That should hopefully be relatively straightforward.
      • Last time - tried running the python implementation to try and sign some artifacts - didn't get past the python dependencies.
        • David: I think the python implementation may be built around Python 3. We are doing test fixture generation on 3.9
          • First we had to update local python on all our Macs ;)
      • The client side looks far enough along that it is probably ready to support testing the
    • Neil:
      • Drupal.org doesn't have an implementation up yet, because we have a much more complicated online signing set up with lots of contributed modules to manage.
      • David recommends: Don't use TUF CLI, use light wait scripting around repository tool
        • Import repository_tool
        • What I would do for your case, Benni - get the right python scripts to do what you want.
        • Benni:
          • I do need to think the way that things are currently located on our servers, and where we execute this stuff - plus need to get the root signing going.
          • Then a matter of writing python scripts.
            • David: Script could pretty much just read the parameters from python and pass to repository_tool
    • Benni/David:
      • In the end, our roadmap may overlap a lot as far as a package manager for end-users
      • Jess: Many of the steps you still need to do for Composer transition we have probably had to try to solve in Drupal - so please borrow our examples!
  • What about the A/B bootloader?
    • xjm: Right now we have a less complex alternative to use a Composer plugin to do this rather than a full A/B bootloader.
    • Benni: For a long time we've been running multiple codebases using the symlink strategy - although not yet through the GUI.
    • xjm: Something to revisit later, ultimately
  • Future work:
    • We could do a complete week-long sprint just on solving the proxy signing problem
    • Let's make progress on first party signing and pitching it to upstream Composer folks **before ** we try to solve this problem. Hopefully Composer will upstream it and we won't have to do this.

Agenda Nov. 13 - stand up

  • Ted:
    • Still working on the target downloading and verification PR
      • Problem with merge with new fixtures
        • One issue may just be expectation change? 2 vs. 3
        • The other file is saying target file is not properly signed?
          • Need troubleshooting
          • Will pair with @dts
      • Will do some more validation - looks like there's another step in the spec
    • For the week:
      • Primarily focused on the target management portion of the spec
    • Next steps:
      • Rest of the spec
      • Looking at the classes for understanding how to reproduce fixtures
  • David:
    • Focused week on supporting testing
      • Started the week with fixtures being generating on the python script
        • Simple and complex and delegated pre-defined fixtures were what we had
        • Migrated these to running on github actions for generation, so the file generation doesn't produce the repo
          • The downside was brand new fixtures every test run.
        • Focused then on making fixture generation deterministic
          • About 99% of the way - a few implementation details that can change based on what platform you run it on.
          • So definitely the same from run to run on same platform.
        • Also refactored tests so that to build out a new fixture we can do so with minimal definition.
      • Today:
        • Work with Ted on testing
        • Expanding fixtures for more happy and sad paths
  • Adam:
    • Focused week:
      • Delegated tasks to get up to speed on this project
        • PR reviews
        • Working on two github issues - 60/61
          • Need to solve existential questions about what kinds of exceptions there are and how we want to handle them.
          • Did open a PR - can remove a few exceptions - from public methods not called.
          • Do have to decide what we consider a TUF exception vs. not a TUF exception.
            • Maybe chat chat about with David and Mike
        • As far as getters for various meta-data things
          • There's already places where we've added some methods we wound up not using
          • Think we should focus on adding some getters where we need them
          • David: We're straddling a bit of a line where we're creating this not just for Drupal's library, but for PHP tough in general.
          • Should be open to things in this library that are not things we're consuming.
          • @TODO: we should consider
      • Today:
        • Did actually open a PR with unit test coverage for the file storage class
  • Jess:
    • Overall trajectory:
      • Someone interrupted with externalities
      • Discovered plan to add header links to php-tuf is causing some word wrap changes, making it hard to review
      • Want to go back to the primary goal of the best way to describe the spec in our code comments.
        • Might go to parts of the existing updater that's not in progress yet
    • Today:
      • Want to finish that PR, and will read the contribution guidelines
      • Want to chat with Benni in two hours
  • Alex:
    • Overall trajectory:
      • Intrigued about the discussion about using Composer plugin working directory instead of A/B bootloader
      • Looked at architecture of Composer plugin
        • A little bit worried that catching all the elements of subclassing and reimplementing a plugin might be brittle.
        • Nice alternative to having an A/B bootloader (certainly at least for now)
      • Another alternative:
        • Have a Composer plugin restart Composer pointing to a different path - could make sure everything got reinitialized
          • That begins to look like - maybe we should start doing it outside of Composer.
      • For now: going to keep proceeding with the plugin
        • Jess: maybe not this week, but later could we do some sort of demo what each of these methods would imply in terms of pros and cons.
        • Ted: The brittleness worries me around path management, particularly if there are other plugins that access some of this path info.
          • David: Some things can stay in the same place, cache dir, other scratch dirs, composer.json src - mostly it's the write out that needs to change.
          • Writable things that need location swap: Composer.json, composer.lock, everything being downloaded
  • Neil:
    • Yesterday disappeared
    • Overall
      • Investigated python server-side implementation
      • Go over with Benni at call later today.
  • Ted/Lucas
    • Have a session at DrupalCon Europe!
    • We should coordinate about turning this into a panel discussion, or at least in supporting the content of this session.

Sprint 2: September 8-10, 2020

Recap

Discussion session recordings

Meeting minutes

Agenda Sept. 10

  • Ted: Working with Peter on the metadata validation
    • Today:
      • Continuing to work on meta data validation
      • Adjusting validators to be okay with both target/non-target file validation
      • Keeping to that scope in this pull request
        • Follow up issue for expanding getters
      • Question: Intersection between role db and metadata getters
        • We could grab directly from validated meta data or have the role db do that?
  • Mike: Re: TUF - still trying to get the Composer plugin operational with the basic static Composer and TUF repository
    • Got sidetracked yesterday with an unrelated feature request for Composer
    • Today:
      • Finishing up first Composer plugin implementation
      • Pass it off/review with David to look at the cloud functions for a real tough repo proxy for Composer
  • David: Got in the fixture changes and the script to tear-down and set up a fresh repo locally - with all properties we want to express
    • Our tests are already using the updated fixtures at least to the extent we were for previous fixtures
    • Chatted about mapping the operations for Composer 2 to rely on TUF as source of trust
      • Today:
        • Carrying forward the torch on Composer and TUF trust conversation
  • Jess: Haven't done too much since yesterday afternoon - PR 18 got merged which is great
    • Today:
      • Would like to also sit in on the Composer plugin
      • @Tim: Can you share the recordings?
  • Neil: Got python environment running and ran test fixtures to get an idea of what might be needed server side - did a small PR for test fixtures

Agenda Sept. 9

Stand up:

  • DTS: Test fixtures are largely working with the python library
    • Still need to work on the delegation component
    • Linked in Slack to a Go implementation including the CLI for TUF as well
    • The interface is 'repository tool' with just about 1 to 1
    • Today:
      • Continue working on the delegation support for the test fixtures
        • This means we may need to review/change how we interact wit the new fixtures
  • Ted & Peter: Working on making classes for the meta data
    • Created a pull request against Mike's existing PR #18 for 2.1 and 2.3
    • Made classes for json decoded metadata - using symfony library validator for role and key storage
    • Today:
      • Continue working on the metadata for json decode
  • Jess: Was reviewing blockers for PR
    • Implemented change for documentation - has an open PR
    • Reviewed the PR that Ted made with documentation about relationship to the spec
    • Today:
      • Ready now to review PR 18 for consistency and conformity to the workflow
      • File issues for anything remaining
  • Neil: No real time to spend on the infra implementation today
    • Have time today to work through it.
  • Lucas: Joining as of today
    • Just reviewed the changes for coding standards PR - approved and merged
    • Definitely interested in the Composer discussion
    • Keeping up to speed on what's going on
  • Alex: Has been out this week
    • Maybe we can schedule something a couple hours from
  • Mike:
    • Composer discovery yesterday
      • Package discovery process also concerned with TUF
    • Yesterday:
      • Working on line-by-line implementation
    • Today:
      • Continuing with that today

Agenda Sept. 8

**Current progress: **

  • Pull requests up through workflow steps 2.2, 2.3 - #18 - needs review by Jess? Might be ready for merge
    • We have unit tests but not functional tests for this PR
    • Ted has started a branch locally to add functional tests (may need to do by manipulating our fixtures)
    • Mike: We should probably bite the bullet and write the Python to generate test fixtures
      • Who is Python familiar lately?
        • David has used it extensively
  • We need to regenerate test fixtures with the Python API
    • When we attempted to regenerate fixtures with delegation using the CLI tool there were some issues.
    • The CLI tool is pre-release software.
  • Jess: Worked on coding standards things, looked at the documentation PR, will look at PR #18
  • Considerations for Composer and PHP TUF for autoupdates
    • Need to be able to do metadata discovery without using HTTPS - should be able to write a plugin that can do this, if it's not supported directly by Composer 2
    • However, we should be aware that we might be able to do something from a Drupal and Technical perspective that is great, but not necessarily
      • Can we find someone to pair with David on this?
        • We don't necessarily need the client library done in order to work on this - and it'd be better to discover this sooner than later.
        • Mike might be open to trying to work on this.

How much time do folks have this sprint, and what are folks working on?

  • Ted has this full week
    • Like Mike's idea below about the refactor of json decode
    • Implement other happy-path steps - don't think we need the delegation fixtures for the immediate next steps.
  • Mike available for the full contribution days
    • A few things could do:
      • Implementing more detailed workflow from spec
      • Right now all our representations of metadata - json decode, associative array - do a more structured transformation into a class with known typed properties - biggish refactor. ← Jess agrees
  • Jess available for most of the next three days - committer meeting early on Thursday morning.
    • Community and internal autoupdates meetings
    • Security release wrangling for next week - but can mostly leave that for Friday
    • Focus:
      • Wanted to reread the spec fully again
      • In addition to merging step 2, we're also still missing a couple bits of step 1
        • Need to make decision about where to produce errors - checker itself should throw exception, decide how to do exception handling
  • David fully available for this project, other than for about three hours here and there.
    • Very flexible about what to dive into
      • Python work on test fixtures for TUF
      • Could also work on bootloader concepts
        • Per Ted: If we do this, lets include Alex
          • Alex does have a few meetings that might take half time but could rejoin later in the afternoon
      • Need to verify Composer 2 support for metadata discovery in a non-https manner, either natively or via a new plugin
  • Neil available roughly half-time - definitely feeling the catch up from holiday weekend already today - hopefully more time tomorrow and thursday
    • Main thing to do - start thinking about transforming the server-side diagram into actual server side services.
  • Tim availability not totally clear - getting caught up after a week of vacation
    • Will try to be available to listen in as much as possible and take notes on progress
    • Will likely publish the collaboration blog shortly
    • Will work with Neil on scope of the server-side work.
  • Peter trying to carve out time in the next couple afternoons

Sprint 1: August 3-7, 2020

Recap

Discussion session recordings

Meeting minutes

Composer project

  • They are primarily focused on the work on Composer 2 itself, they'd like to see where we as a collective group of PHP projects go with this However, the framework for Composer is being built to be extensible - Lucas Hedding has been doing proof of concept work for Drupal 9 and Composer 2, and has managed to get in some features that will support signing as a Composer plugin.

Considerations by Project

  • Typo3 - We are not requiring people to use Composer, so there are naturally lots of extensions and things to be considered with TUF that aren't Composer-based workflows
  • Joomla - Similar, we also both Composer and non-Composer based users
  • Drupal - We're in the same place, with a long tail of users with non-Composer installs -- however we are trying to align: Filesystem for both Composer and Non-Composer installs is the same i.e: Drupal tar.gz's are 'Composer ready' - but not Composer required necessarily

Project vs. Product

  • Our definition of project is: a code base you might assemble, install, and then stage and deploy an artifact (Framework being extended)

  • Our definition of product is: an artifact you download, install, and maybe add add-ons to. (Out of the box software)

  • PHP-TUF should be totally agnostic to distribution method (non-Composer/Composer, whatever)

  • We all have users that need extensions/plugins

  • We all have multiple distribution methods zip/tar.gz/composer

  • We all have users with different levels of technical sophistication and different technical environments

  • We likely all need to accomplish our signing and trust verification on the Build infrastructure for our respective projects and the products we output for distribution.

How does this align with the strategy the projects represented here?

  • For Typo3 - this very much matches the way we build our projects - what's most important to us is collaboration on the signing/verification tools, and then we can work on the actual build infrastructure.
  • For Joomla - I would agree that the architecture makes sense for our core packages for sure - however for third party extensions it is tricky - our 3rd party ecosystem consists of submitted extensions on third party hosting that aren't hosted/built directly by Joomla project.
  • When we do implement secure signing, we do intend to centralize it on Joomla's build infra, rather than making developers responsible for it.

Some considerations from the early experiments in Drupal space:

  • Our early implementation requires resigning all artifacts with the intermediate keys when they are renewed - in the Drupal space it takes about 3 or 4 days to resign everything right now.
  • TUF would allow renewal of the trust without resigning.

So if we are all aligned - how do we propose to collaborate?

Two or three separate pieces that can happen independently:

First - TUF Build Libraries
  • Productizing the build infrastructure pieces. Can we generalize this into an opinionated set of tools that would support this build infrastructure?
    • i.e: Set up a yubikey or other trusted key
  • Here are the signing and verification libraries - here are how they use this.
  • The payloads might be small enough to use simple queuing (right now Drupal)
  • What would the deliverable be?
    • Almost a cloud appliance? TUF appliance?
    • Reuse a lot of Drupal work
    • For Typo3 - it would make sense to start with an outline of all the build process items, and what tech is involved - see where the TUF signing/verification would fit into the stack.
    • For Joomla - Who do we need?
  • Drupal folks who are knowledgable about our early build process
  • Typo 3 and Joomla people who are knowledgable about their respective build processes.
  • Sprint time: 3 day window
Second - PHP TUF Library
  • On the client side, we need at minimum a PHP library that has verification
  • We don't necessarily need our own implementation of signing itself, as there are really good reference implementations available now (Python primarily)
  • PHP-signify got out the door because we used the bsd-signify command line implementation to build a bunch of test fixtures that we built the php-signify library.
  • To get the TUF verification PHP library - use the Python library to build test fixtures to develop PHP TUF verification against.
  • We need a sample public key and sample artifacts that we'd verify against.
  • We also need to spoof a date, so the text fixtures don't expire
    • (PHP signify has models for this) TO DO:
  • Look at minimum version support
  • Make sure we have people from each project who can identify all the constraints.
  • PHP Signify supports ^5.3 || ^7.0: https://github.com/drupal/php-signify/
  • Deliverable:
  • PHP TUF library
  • Sprint time: 3 day window
Third
  • It's one thing to be able to validate arbitrary files over http using the php library, it's another way to understand how to manage it in the context of Composer
  • Composer is not doing any packages, it is only packaging meta-data, but all it's doing is linking to the packages on the large platforms (GitHub, Bitbucket, GitLab, example package meta-data)
  • Just uses the archive available - just need a tag.
  • We might be able to do something like a GitHub action and store as a build asset
  • Phase ¾ type things - we could do later.
  • If you'd want your project to be signed, you'd need to include meta data that would trigger a signing process.
  • Where would we choose to centralize the chain of trust? Or decentralize to individual developers?
  • Could imagine a world where packagist signs GitHub tarballs? But it could have risks are rebuilding?
  • Best of all worlds would be to get Packagist itself signing the meta data - if that's possible it's easy to trust the meta data.
  • Composer integration
  • Creating the Composer 2 plugin. PoC showing how to intercept the download and validate it at https://github.com/heddn/php-signify-composer-integration

Action items: