Problem/Motivation
After much discussion and deliberation with the security team and core committers, it has been decided that TUF protection will be required for the use of Package Manager in virtually all cases.
Right now, packages.drupal.org is still in the process of rolling out TUF support. We need to be ready for that, by having the code in place to ensure that Package Manager operations will be protected by TUF.
Proposed resolution
We should add a validator that checks the following on create, require, and apply, in both the active and stage directories:
- The PHP-TUF Composer plugin is installed.
- And enabled in Composer's
allow-pluginsconfig. - And configured to protect the
packages.drupal.org repository, which must be defined in composer.json.
If any of these things aren't true, the validator will flag an error.
For now, this validator should be added as a service, but NOT tagged as an event subscriber. That will be done in a follow-up, when we add a hard dependency on PHP-TUF: #3358504: Require PHP-TUF's Composer integration plugin
Issue fork automatic_updates-3316617
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
Comment #2
tedbowComment #3
tedbowWe could make a validator and test and but then disable this validator in our base tests until the integration is done.
So we could have 1 test covers our validators
Comment #4
phenaproximaComment #5
phenaproximaComment #6
tedbowComment #7
wim leersIs there an issue this can reference?
Comment #8
tedbowComment #9
tedbowAssigning to @phenaproxima
re chat and
He said this not a good idea
also
@adam.hoenich
were you thinking that in core we would add php-tuf to the core composer.json?
because if we didn't AU would not work "out of the box" and depending on product decisions PB won't either if required TUF
Comment #10
phenaproximaMy current thinking is this:
To me, this is the best of all worlds:
Comment #11
tedbow@phenaproxima thanks!
This sounds ok . I think the only downside is that people using AutoUpdates on 7.4 would not get Cron updates which is what most people want but that seems to be outweighed by
Assigning this to @Wim Leers to see if he sees any problem with this approach because I think as soon as we require 8.1 for php-tuf and start to use its features it would be a pain to downgrade.
Comment #12
tedbowComment #13
wim leersWhy not require a hard dependency? For the contrib project we shouldn't (agreed!), but for core we should? I think that's what the end of #10 implies?
I 100% agree that getting unattended updates working for ~116 sites of which some fraction is on PHP 7.4 is not worth our time. We need to think about the ecosystem impact first and foremost IMHO, which means not worrying about unsupported PHP versions, i.e. PHP 7.4.
So +1 for @phenaproxima's proposal from me 🤓
Comment #14
tedbowI think for core yes should have php-tuf as a hard dependency because cron updates in the killer feature for core so having someone have to do another manual composer operation to get there seems not great.
We could also make it hard dependency of 3.x
Comment #15
phenaproximaYes, that's what I meant. Core should have the hard dependency, but the contrib module shouldn't.
Comment #16
wim leersSounds like we're on the same page! 🥳
Comment #18
phenaproximaUpdated the IS with the proposed resolution.
Comment #19
phenaproximaComment #20
phenaproximaComment #21
phenaproximaComment #22
tedbowCore may require php-tuf when we merge in. @phenaproxima do you foresee and problems with this? I assuming we don't have any dependencies in php-tuf that core would not want to have an indirect dependency on, like we currently have in Au with
composer/composerComment #23
tedbowAssigning to @phenaproxima for feedback on my idea in MR
Comment #24
tedbowAlso setting to needs work because even if we don't decide to do any of the ideas I proposed I think at the very least we need to be clear in the messages the security implications. Probably also with @todo to follow-up issue that will provide a link to docs
Comment #25
phenaproximaComment #26
tedbowComment #27
tedbowComment #28
wim leers@tedbow and @tim.plunkett discussed the plan for getting Automatic Updates, Project Browser and Package Manager into core. We're likely going to aim to land Package Manager first. So postponing this issue for now, until the dust settles on that.
Comment #29
tedbowRE: #3349368: [policy, no patch] How much of The Update Framework integration is needed for alpha-level review/commit of Package Manager?
We need TUF for package manager to get into core at all.
from this issues summary
We should confirm that with a question in #3349368. It may be the case that all package manager operations need TUF or at least AutoUpdates and Project Browser.
Comment #30
tedbowComment #31
tedbowComment #32
wim leersBumping to critical per #29. But … is this even actionable? Isn't this hard-blocked on #3325040: [Packaging Pipeline] Securely sign packages hosted on Drupal.org using the TUF framework and Rugged? 🧐
The current MR needs to be redone anyway, because it's still targeting
8.x-2.x.P.S.: I think
should be
😓
Comment #33
tedbowre #3284443-11: Enable unattended updates I am removing
unattended update blockertag as I propose we don't block this in contrib only. But it is still an alpha target because we would need this in core for alphaComment #34
tedbowRe the current action that is needed is to make a new MR against 3.0.x from the current 8.x-2.x MR
Comment #35
tedbowI think we need "Needs issue summary update" before we do more work on this because of the changes made after this comment
re
We need to get confirmation from core committers that it is ok for modules building UIs to opt out TUF protect for their use case.
The reason I think it should be ok is otherwise if we make it too difficult to opt-out then I could see developers trying to do this by just removing our validator service altogether. That would be very bad because it would turn off TUF for all use cases
Comment #36
wim leers#35: Did we get that clarity? I don't see it on #3316617: Add a validator to check that PHP-TUF's Composer integration is present and configured correctly? 🤔
Comment #37
tedbow@Wim Leers on #36 you linked back to this issue. Did you mean to link to #3349368: [policy, no patch] How much of The Update Framework integration is needed for alpha-level review/commit of Package Manager??
Comment #38
wim leersYes 🙈
Comment #39
tedbowComment #40
phenaproximaComment #41
wim leersFirst round of review! This is looking great already 😊
Comment #42
phenaproximaComment #43
tedbowre-assigning to @phenaproxima until tests pass
Comment #44
phenaproximaComment #45
wim leersReflecting that this is hard-blocked on #3358012: StageBase::stageDirectoryExists() breaks on PreCreate.
Comment #46
wim leersDetailed review posted. Chief concern: this should behave more like
\Drupal\package_manager\Validator\ComposerPatchesValidator, at least the way it is implemented since #3252299: Reliably support cweagans/composer-patches in Package Manager & Automatic Updates: validate stage.Comment #47
wim leers#3358012: StageBase::stageDirectoryExists() breaks on PreCreate landed.
Comment #48
phenaproximaChanging title to reflect the reality that TUF is basically always required for use of Package Manager.
Comment #49
phenaproximaMaking the title a little more specific, since we're not (yet) adding a hard dependency on PHP-TUF.
Comment #50
phenaproximaComment #51
phenaproximaFiled #3358504: Require PHP-TUF's Composer integration plugin to actually bring this validator into action.
Comment #52
tedbowThis looks good, but I will have to give it closer look. Didn't find anything I object to though
Comment #53
wim leersThanks for opening #3358504: Require PHP-TUF's Composer integration plugin. Agreed with landing as much as possible NOW, before the d.o infrastructure side is complete 👍 I expanded the information in that issue.
I did still find a few things to be concerned about, but it's definitely closer now!
Comment #54
phenaproximaComment #55
phenaproximaComment #56
wim leersExcellent work here, and thanks for bearing with me as I scrutinize every line …
Comment #57
phenaproximaComment #58
wim leers🚢
Comment #59
tedbowJust 1 suggestion for test coverage
Comment #60
phenaproximaComment #61
tedbowWorks for me
Comment #62
phenaproximaComment #64
phenaproxima