Problem/Motivation
The Automatic Updates Initiative and the Project Browser Initiative both are creating modules that will add user interfaces for running Composer commands to add and update projects.
While this does not introduce completely new supply side attack vectors it does mean this can be triggered via the UI and in the Automatic Updates case it will introduce an unattended process that updates Drupal core(and maybe eventually other projects).
There 3 modules that will be added to core which will go through the experimental module process
- Package Manager: the API only module that makes the composer commands. It is currently a sub-module of Automatic Updates in contrib but would be its own module in core.
In addition to eventual adding of "The Update Framework" integration, this module also provides additional security hardening over using Composer directly:
- Requires https to be used for Composer
- Requires https to be used for fetching Drupal.org update XML
- Ensures that all drupal.org projects are on secure versions according to drupal.org update XML
Both the other 2 modules require this module and get this extra security hardening
- Automatic Updates: the MVP for core only updates Drupal core. It provides both a form and a cron process that updates core. It allows 3rd party vendor packages to be updated or added if required for core update. It does not allow other Drupal projects to be updated during a core update.
- Project Browser: It installs new modules and themes via Composer. 3rd party vendor packages are allowed to be updated and other dependencies It does not allow core to be updated while a new project is being installed
It has been decided to that Drupal will implement The Update Framework(TUF) to enhance security against supply side attacks.
We need to determine, or just have written down if already decided by Drupal core Release and Product managers, at what stages of the core experimental process integration with The Update Framework is required.
Technically it is possible to do the validation either
- In package manager so that all dependencies require it
- In either or both Automatic Updates or Project Browser. Or only when using those modules in certain ways, for instance only for cron updates in Automatic Updates
It should be noted since TUF validation is done on the Composer plugin level that once a Drupal site is setup to use the TUF integration all Composer commands whether through new UIs or through the command line will require TUF validation for operations on drupal.org projects. Composer configuration would have to be updated to opt out of TUF integration
Questions that need to be answered or clarified:
- Is TUF integration an Alpha requirement for Package Manager?
- Is TUF integration requirement the same for Package Manager, Project Browser, and Automatic Updates?
Proposed resolution
A production set up of the TUF is not required prior to an initial commit of Package Manager in Drupal core. This also applies to Automatic Updates and Project Browser.
A testing module to allow testing package manager/automatic updates against d.o's dev packagist endpoint might be needed for the reviews but might not be necessary especially if TUF is deployed on d.o production before an alpha commit, or if there's a way to easily configure this without a testing module for people testing locally. Even though it hasn't been identified as a hard blocker at this point, let's try to implement a way to opt-in for TUF testing to help testing and reviewing it in the meantime, even if it's only very temporary.
Remaining tasks
Make TUF testable against Dev Repe
See #40
https://github.com/php-tuf/drupal-project/ will create a test project that will use the TUF protect DEV metadata but this does not validate this inside of Package Manager.
Here are follow-ups for this
- Github issue: Create test module to enable TUF validation in Package Manager
- Contrib module: #3416768: For testing purposes, allow PhpTufValidator to validate repositories other than packages.drupal.org
Comments
Comment #2
xjmThe signing and verification toolchain and d.o-side support for core and contrib release signing is required prior to Package Manager (and therefore the modules dependent on it) being beta experimental in core.
Comment #3
tedbow@xjm thanks for clarificaion.
I updated the summary per #2
Comment #4
effulgentsia commented@xjm and I discussed this, and this is incorrect. TUF blocks alpha for all 3 modules, because a security review blocks alpha, and TUF is needed for a proper security review.
Comment #5
tedbowUpdated the summary based on #4
Comment #6
tedbowSince I am not sure where all of this is documented in public I am trying to give more context that I am aware of. Obviously I am not in core governance so please correct me if I am wrong or add more context but here is what I have found in Slack.
Need for TUF before Alpha
From November 22, key points but see the link for exact conversation:
@xjm
@tedbow responded
and
From the link I quoted
@xjm pointed out
From my understanding from in person conversations with @xjm this is a major reason for blocking any commit of Package Manager, Project Browser and Automatic Updates in core.
@xjm added
Pivot to Project Browser
I took the conversation above to be related to specifically getting Automatic Updates at the Alpha stage into core because of its unique security implications. Since we could not get Automatic Updates into core without TUF integration which was blocked by implementation on the drupal.org side the Automatic Updates team switched from working on trying to get Automatic Updates into core as Alpha to working on Package Manager Alpha blockers to unblock getting Project Browser into core as alpha.
We believed(wrongly as it turns out😔) that Project Browser getting into core as Alpha was not blocked by TUF because it did not have the same security implications of unattended operations used to deliver critical security updates.
see from slack #autoUpdates
and #project browser
At this point we opened up #3346707: Add Alpha level Experimental Package Manager module and postpone #3253158-20: Add Alpha level Experimental Update Manager module
see @wim leers
Comment #7
wim leersBeing new to this initiative since November, this definitely was a shocking surprise 😳
Looking forward:
package_manager,automatic_updatesandproject_browserare blocked on #3325040: [Packaging Pipeline] Securely sign packages hosted on Drupal.org using the TUF framework and Rugged?Comment #8
tedbow#7
I am not sure how "[policy, no patch]" issues get closed but I was hoping that the "Proposed resolution" would reflect what the policy is so it is clear for everyone. So I'm adding the needs release manager review, and needs product manager Review tags, Because I'm assuming somebody in one of those roles would have to give the sign off on or update the proposed solution is the policy.
Comment #9
catchI have not been following this closely, but I guess now I'm following it a bit closer because this has come up.
A thing I am not clear on is this, which is a copy and paste of Ted's last comment from that slack thread (assume it's fine to quote it since it was linked):
It's my understanding that rugged is deployed to d.o staging, that there is one known rugged blocker for php-tuf (hashed bins). Once hashed bins is available (in the client and server), then it should be theoretically possible for php-tuf, package_manager, and d.o staging to work together as a proof of concept.
However there are various other rugged blockers (queue crashes, terabytes of storage duplication) which won't affect php-tuf but do make it not deployable to d.o production yet. And it might not be possible to sign everything on d.o staging due to the scalability/storage blockers or at least not without as-yet-unimplemented workarounds.
That means, assuming the above is accurate now, and stays accurate, that there is a window between php-tuf and the code that depends on it being theoretically alpha-complete, and TUF being deployed to Drupal.org production.
It seems like a code review of php-tuf and friends could happen at that point - at least, that would be an option for when reviewers could start reviewing if not finishing.
But even if review can start then, it probably wouldn't make sense to review rugged until it's about ready to deploy to d.o production. Also it might not be possible to sign all packages on d.o staging, meaning user testing would be hampered (assuming we can even point end-user composer.json to d.o staging in the first place) and probably pen testing too. But we're not reviewing rugged for core inclusion, it's context for a php-tuf review as far as core is concerned if not the entire system.
For me it would make sense to at least inform people that different aspects are possible to review when they are, then people can either review early and often as different elements are available, or wait, depending on availability and how they want to approach things. But there would need to be a clear outline somewhere of what needs reviewing, what can be reviewed, what can't etc. at the moment I have no idea where to find this information and asking 2-3 different people gives 2-3 different answers.
Getting this many in-depth reviews from this many people for this many moving parts is going to take a while, so the easier it is to know what to review and when, the better.
Comment #10
effulgentsia commentedI'm retitling the issue to reflect a more nuanced question.
#9 highlights some of the things that would need to happen for a full security review of Package Manager. My concern with that is if we require all of that for initial, alpha-level, commit, then we're effectively putting Project Browser reviews on hold for months, potentially making the difference between whether Project Browser can be released in 10.2 vs. 10.3. Unless we think Project Browser reviews can happen without Package Manager being in core, but I'm not sure if we have experience with prior core additions being successfully reviewed ahead of their dependencies landing.
I wonder if it would make sense for an alpha-level review (and commit?) of Package Manager to include TUF integration, but against the staging TUF repo, without hashed bins, with only some (10? 100?) modules signed, and without solving the other Rugged issues that still need to be solved before it can be deployed to production.
The downsides of the above would be:
The upside would be:
Comment #11
effulgentsia commentedHm, for some reason, I seem unable to change the title of this issue. I think the title should be:
[policy, no patch] How much of The Update Framework integration is needed for alpha-level review/commit of Package Manager?
Comment #12
effulgentsia commentedComment #13
catchI don't think this is feasible, from comments by @phenaproxima in slack somewhere, the problem is that the metadata file without hashed bins is something like 200mb, which will crash when you try to parse the JSON. Also the client needs to support hashed bins for when it's available, and there is other stuff to do in package_manager before it's ready to review anyway, so hashed bins at the moment is unlikely to block review for long or at all, and package_manager can't work without it.
Comment #14
xjmThere's some misunderstandings here still so I'm just going to summarize some more from the ongoing Slack discussion.
TUF blocks Package Manager alpha for the following reasons:
TUF is a significant part of the Package Manager MVP and will be a nontrivial amount of code, so Package Manager doesn't make sense as an alpha module without it.
For the same reason, doing security review without TUF implemented doesn't make sense; Package Manager is fundamentally an insecure design without it and we know that, so there's no reason to do the needed security review for alpha without that code being implemented.
The contrib AU module currently mitigates the lack of TUF signing with:
We can't require HTTPS for core, even for alpha, because not all hosts support it and so the module could put a site on such hosts in a state where nothing can be installed or updated. This is a serious data integrity and upgrade path problem, which is one of the few reasons release management will get involved in alpha requirements and say "no" to something.
However, we were willing to allow a Project Manager beta that just provided composer commands (and did not install anything) which therefore would not be blocked on Package Manager. We offered that option to the initiative team, but from their perspective it wouldn't actually be helpful to them due to the extra overhead etc. For PB, they are comfortable targeting 10.2 once Rugged/TUF is implemented and deployed.
A similar approach is not available for Autoupdates, because the whole point of getting it into core is to review and test the tool that writes updated Drupal core code to the filesystem, and so there's no functionality to make an alpha of if you take away Package Manager support completely.
The decision to require functional TUF integration code prior to any core commit has now been re-discussed and re-made in:
Edit: I would appreciate it if folks responding here would not try to re-litigate workarounds to any of the above points, and treat the decision as made, in the interest of maintainer health and bandwidth if nothing else.
Edit 2: Apologies that my initial comment mentioned beta and not alpha. Did not mean to add to the confusion. I thought the sense of urgency was coming from trying to get a beta done in time for 10.1, which is not achievable. There are no release deadlines associated with alphas.
Comment #15
ergonlogicComment #16
xjm@effulgentsia and I spoke more about this issue.
We both agree that a working TUF implementation is a requirement prior to a core commit of autoupdates.
The main point we disagree on is whether TUF is also a requirement for an alpha of Project Browser, and whether the tradeoffs for the review process are a net loss or gain overall.
@effulgentsia believes what Project Browser does is sufficiently similar to the current module download functionality, and that we could safely require HTTPS instead of signing and verification as a temporary alpha requirement.
I on the other hand am concerned about the drawbacks of adding such an incomplete Package Manager to core in terms of the review process, user testing, and security, and I'm also concerned about the complications and possible critical disruptions to alpha testers from adding a temporary HTTPS requirement. I furthermore think it adds overhead and risk to the review process without improving the release timeline for the modules.
However, we both have the same goal: Start code reviews and user testing for all three of Package Manager, Automatic Updates, and Project Browser as soon as possible, and smooth the path to core inclusion.
The compromise we agreed on is that we should begin core maintainer reviews of the Project Browser contributed project as soon as possible. We also should expand efforts for user testing of composer-stager, Automatic Updates, and Project Browser using the contributed projects. Finally, we can potentially open a core merge request for Project Browser sooner rather than later, even though it may not be committed until the working TUF implementation is added.
To this end, I think we should create a core issue for maintainer code review of the Project Browser contributed project (tagged for release manager, framework manager, and JavaScript review). We should also plan user testing sprints at upcoming events, and have some communications promoting user testing of the modules.
Comment #17
tedbowre #14
After chatting with @catch I created #3351190: [policy, no patch] Should Package Manager require Composer HTTPS? instead of just adding the discussion here because it might be more technical discussion about host support. But that issue goes over the implications, as I understand them, of not requiring HTTPS(in addition to TUF not instead of) given the scope of TUF protection proposed in #3325040: [Packaging Pipeline] Securely sign packages hosted on Drupal.org using the TUF framework and Rugged, no TUF protection for 3rd party dependencies. I pinged @drumm and @hestenet unless in case I am wrong about the scope of #3325040
Comment #18
tedbowJust FYI, even though it seems like from the above that #3346707: Add Alpha level Experimental Package Manager module is not going to get a review right away, I wanted to let people know we have update the summary there to be much more complete if anyone wants some light reading😜
Comment #19
wim leersFirst round of review! This is looking great already 😊
Comment #20
wim leersWrong browser tab 🙈 … and so consider this a serendipitous "bump" 😅
Since #18, #3351190: [policy, no patch] Should Package Manager require Composer HTTPS? has had further discussion and the corresponding issue for the Package Manager module (#3351247: Harden our HTTPS requirement) landed 5 days ago.
That means this issue indeed needs review. Restoring that state.
Comment #21
catchHashed bins appears to be implemented in rugged as of a week ago, that leaves one outstanding ruggeed issue listed on #3325040: [Packaging Pipeline] Securely sign packages hosted on Drupal.org using the TUF framework and Rugged, which as far as I know is more of a nice to have or possibly production blocker. I think that means TUF on d.o staging is unblocked now.
That's all within just over a month since this ticket was opened, so to me it doesn't look like TUF is a long term blocker, it looks like the last few bits are being ironed out in testing and getting fixed promptly enough - at least enough to run on staging so everything can be reviewed.
Comment #22
wim leers#3316617: Add a validator to check that PHP-TUF's Composer integration is present and configured correctly has landed. That means we're now just hard-blocked on d.o infrastructure at #3325040: [Packaging Pipeline] Securely sign packages hosted on Drupal.org using the TUF framework and Rugged to actually enable what
#3316617introduced, and we have #3358504: Require PHP-TUF's Composer integration plugin ready and waiting for that 👍Comment #24
catchWhile TUF isn't deployed on d.o packagist in production yet, it's mostly deployed on staging, production blockers are well documented and in progress, the security audit has started and is going well - so for me all the things I was concerned about in March have been met by now (or months ago, but I also wanted to get #3351190: [policy, no patch] Should Package Manager require Composer HTTPS? resolved properly too). i.e. it should be possible to holistically review package manager with PHP TUF together, and it'll be valid for when it's all deployed and working together because major changes aren't still in the pipeline. I don't know the situation of the external audit for PHP-TUF and friends but sounds like that also might start sooner than later.
I would also like to see us commit PM/PB/AU as early as possible in the 10.3.x/11.x cycle so that they get a good round of alpha/beta testing before the next minor release.
Additionally, because we'll have the 10.3.x and 11.x branches open at the same time (which we have not had an equivalent situation since 9.5.x and 10.0.x), if we remove/disable guardrails, it should be possible to test updating from 10.3.x to 11.x and/or from 11.x alpha releases to later 11.x alpha releases, without actually having to have automatic updates in a tagged stable release as beta. This would make a core commit as alpha a lot more useful than it would have been when it would only have been alpha in one branch.
Are there any remaining concerns here? Or if not it would be useful to sort out the actual alpha reviews a bit more systematically.
Comment #25
tedbow@catch #24 sounds positive!
#3394754: [policy, no patch] Use Update XML in Package manager to determine release support status is the big unknown as far as remaining work on the Package Manager and Automatic Updates module. The issue will probably lead to more work in the modules, though not a ton
Comment #26
tedbowJust to super clear regarding my response in #25
from #24
For the benefit of others who haven't read #3394754(catch has) our team is not working on this problem because depending what is decided by core committers the solution will be different. From my understanding as the tech lead I can only suggest a solution to this problem but the ultimate decision is for core committers, because how much of the systems needs TUF protection seems to be product level decision and #3394754 deals with this . Not complaining just want to be clear this is stopping us doing the work to solve this problem because I don't want to do the work 2x. Once the way I think we should and once they committers ultimately decide(I could guess right only have to do it once but 🎲)
I guess the only way this does not put
The bigger problem is "alpha" testing. Since alpha experimental modules are not in releases I think this will be much more difficult. The module is not meant to be used with dev versions so that would problem with starting from dev version at the alpha commit. We could probably get around that for Alpha testing but I think the bigger problem is the target version would *not* have the updater present is so it would fail(assuming haven't actually tried it and not intended to work that way).
Maybe there would be some way to hack that by using Composer aliases that pointed an alpha version to an actual dev commit but I haven't looked into this.
I have documented this elsewhere but this is I think we can't actually have people manually testing until it is beta and in a release. Of course you can test with the contrib module which as of now is actually to automatically create the core merge request.
Comment #27
catch@tedbow
No it should be fine from that point of view too, this is what I meant with:
We release alphas (actual tagged releases with release nodes) of the new major version well in advance of a beta release - we did this for 9.0.0 and also 10.0.0. This is usually starts once changes like Symfony major updates and similar are in, whatever we decide is a meaningful target for testing, in case contrib modules want to track compatibility against alphas rather than a moving dev target. The alphas are getting less urgent from that perspective the further along things like rector get, but we'll still do them, and then that provides actual tagged 11.x releases to update to/from with automatic updates.
I also think we could do that for 10.3.x too if it helps with AU testing in a way that 11.x alphas don't (like trying an actual major update?), but didn't fully think through the consequences of that - obviously we don't want an actual site getting confused and trying to run on a 10.3 alpha released in January in production, which I don't think they'd ever do with 11.x.
Having both branches in tandem, definitely with early 11.x alpha releases and possibly early 10.3.x alpha releases is the best possible timing for an alpha commit of AU for this reason. Maybe we could do alpha releases of 11.1 and 10.4 but it's not built into the release cycle the same way.
Comment #28
lauriiiDiscussed with @Gábor Hojtsy and we agreed that from our perspective TUF should be at maximum a stable blocker for both Automatic Updates and Package Manager. We acknowledge the integral role of TUF in enhancing security for automated updates, especially when updates are done at scale. However, not having TUF should not prevent us from getting the Automatic Updates in front of the core maintainers, core developers, and early testers. We believe we should do this as soon as possible because now the module is being built in its own silo.
We understand the need for thorough testing before enabling Automatic Updates by default, including testing updates with TUF. However, tying its development to alpha/beta milestones seems counterproductive. We can see that there are benefits to being able to do a holistic security review but it sounds like a lot of this is already possible before the TUF has been deployed on d.o packagist in production per #24.
Concerning the adoption of Automatic Updates, it's clear that a majority of the user base requires a high level of confidence before enabling such features in production. While the contrib module already offers automatic updates, its limited adoption hints at the community's cautious stance on this. In our research, we found that users prefer to wait until Automatic Updates has proven its reliability over time before starting to use it themself.
Comment #29
catchIf it's not a beta blocker, then how will sites running it as beta be TUF-enabled prior to the module being marked stable, so that we don't end up with a rump of sites that never opt-in?
I think package manager can technically run any composer command, so it is theoretically possible to update to a version of package manager that opts you in to TUF for d.o (which might then require a second update to a version of package manager that enforces TUF for d.o - no idea if this would be possible in a one-stage update).
Such a mechanism doesn't exist at the moment, and while it would be useful to be able to opt-in other packagist endpoints if/when they add TUF support (like the main one if that ever happens), it's adding additional stable-blocking technical debt to the module that wouldn't be necessary if it just starts off with TUF support from the outset.
Comment #30
catchTo expand on #29, I think dropping this as a beta requirement adds a lot of additional work, requirements, timeline, and risk.
Let's take a site that installs 10.3.0, and enables automatic updates (experimental) without TUF support.
For automatic updates to be stable, we want the d.o endpoint to be TUF-enabled, so we now have to add a mechanism to TUF-enable this site to core, currently that feature doesn't exist, and it's not on the roadmap, as far as I know it's only brought up once or twice by me as a possibility in various issues. This is what I'm talking about in #29.
Let's say this mechanism wasn't added as a beta requirement, so we still need to add it during beta.
To test the mechanism, we need to take a non-TUF site on 10.3.0, and update to 10.3.1, and make sure it's TUF-enabled after the update.
But now, we also need to check that once that site is newly TUF-enabled, that it can self-update again (i.e. that TUF-enabling didn't break anything like corrupting composer.json), so that requires another patch release, 10.3.2.
We probably also want to add validation that d.o is TUF protected (so it can't be un-protected), but can we even add that validation until we have no 10.3.0 sites left? I don't know the answer to this, but that might be yet another patch release to add that validation - but we can't mandate that sites update 10.3.0, 10.3.1, 10.3.2 etc., they could skip from 10.3.0 to 10.3.2 so that also needs to work and be tested.
Some of the above might be wrong, I am guessing because I haven't thought about it in that much detail. But if it's right, then it's adding two, maybe three releases with complicated upgrade paths we otherwise wouldn't before AU can be stable, or alternatively leaving a rump of sites that would never get TUF-enabled unless they manually run composer commands (which would defeat the object of having package manager in the first place and also penalise beta testers).
All of this is adding a transition from non-TUF to TUF that simply would not exist if the beta-stability module includes TUF from the outset - so we wouldn't need to do any of that work.
Now the work above wouldn't be wasted, because it could be used for packagist.org down the line if they ever add TUF support, but I don't see how that would be stable blocking if we're not trying to change the TUF-status of any endpoints before stable. Only #28 would make all this extra work and testing required.
Comment #31
lauriiiI agree that the complexity introduced by not having TUF enabled by beta Automatic Updates is not ideal. Thanks for explaining in detail the complexity involved with that. However, this risk would be only valid if we didn't have TUF-enabled with the Automatic Updates in the next release. Not having Automatic Updates in the next release seems even worse because it would mean that we would have to wait at least until 2025 for stable Automatic Updates. Potentially even until June 2025, if we follow our current policy where experimental module statuses are only changed in minor releases.
It sounds like we could try to minimize the risk related to enabling TUF after it has been shipped by introducing a beta blocker to evaluate feasibility of #30 if TUF has not been enabled. We could decide on the approach closer to the release depending on the status of TUF. If #30 isn't feasible, then Automatic Updates could not reach beta until TUF has been enabled.
The ideal scenario is still that by 10.3.0 we have TUF enabled Automatic Updates. Unless #30 introduces too much complexity, having Automatic Updates without TUF would be still better than not having Automatic Updates at all. This would enable us to start testing TUF whenever it's done, potentially well before 10.4.0. This way Automatic Updates could potentially even reach stable in 10.4.0, and be enabled by default.
Comment #32
catchThat took time that I could have spent doing literally anything else. Meanwhile #3253158: Add Alpha level Experimental Update Manager module hasn't been updated for two months. Why are people constantly bringing up different versions of this and not instead spending that time getting the module ready to commit? How many hours have been spent talking about it in the past year?
No not really. Beta-stability modules are expected to provide upgrade paths, so #30 comes into play as soon as package manager/automatic updates is marked beta. There is no need for it to be marked beta before a 10.3.x/11.x beta release because there's no real advantage to it being more stable than the core release it's in (not that we shouldn't if it's actually ready, but there are major advantages like upgrade paths and providing bc if it's not ready and marked anyway). The only way to avoid the extra work is to mark it beta after TUF is enabled/required because then there's no upgrade path to deal with at all. This means waiting for TUF reduces work significantly right up to the very last possible beta deadline for 10.3.
The proposal only 'works' if you were to get to the very last beta deadline for 10.3/11.x, know that TUF is not on production, and then mark PM/AU beta at that point, knowing that you'll then have to do all the TUF work and the extra upgrade path during the 10.4/11.1 cycle. But you're then putting that additional, complex, upgrade path in the way of every single beta tester of automatic updates into patch releases of Drupal core, the number of which will increase over time the longer the window is between it being available and that update being added, increasing the chance of buggy updates for something that is supposed to make them seamless.
Comment #33
tedbowI have not caught up on all comments from #28 but want to clarify.
We are working on the contrib which is the source of the core MR constantly. I had not run the conversion script in 2 months because it always take a bit of time because we always find little things that breaks tests, mostly in changes in 11.x, new deprecations, etc.
So I haven't been running the conversion because it takes some time and before last week I was the only person who commented on the issue since April. Because of that I thought it was a better use of time to work on the module. The Needs Review bot marked it as Needs Works
I should have made that clear on #3253158. Sorry about that. I have I have pushed up the latest commits to that issue. The test will still fail because we need to make some adjustments for gitlabci. But I still think this issue is reviewable. The tests pass in contrib which is basically the same module.
We are handling this in the contrib module #3394413: Enable GitLab CI, and use it to build out a core code base with Automatic Updates and Package Manager as core modules. Basically our plan is we will use gitlabci to run the conversion for the core merge request and then run the tests on every contrib issue as core merge request. We will still use drupalci to test the unconverted contrib module.
Once this is in place we should have no more (or many fewer) surprises when run the core merge request conversion. That will allow us to keep it in sync with the contrib module more easily.
Comment #34
tedbowre #30 and @catch's concerns about sites that would run the beta before require TUF
Yes you are correct that it would add some work but I don't think that much. Let me explain how we have the checking now in the core MR/contrib module.
I will use the contrib module code as an example but this is the same in the core with namespace changes(which happen in the conversion)
\Drupal\package_manager\Validator\PhpTufValidatorwhich checks if you have a composer repository using https://packages.drupal.org and that it is TUF enabled, meaning the config values in the composer.json are correct and the php-tuf/composer-integration is present. both of these must be true for you to be TUF protectedevent_subscribertag to this service so the validation does not happen.event_subscribertag to this service. In this test we test for, correct configuration and that we proper error messages if it is not setup correctlyso
So yes if we add TUF validation in 10.3.1 this would basically mean adding the
event_subscribertag to this service. Once it is added then any operation that Package Manager tries would fail if d.o was not TUF protected.For 10.3.0 sites they would not be affected because the validation would not happen for them. Composer operations are only TUF protected if the repository in your composer.json is marked correctly and
php-tuf/composer-integrationis preset. So even after d.o is provides TUF metadata it will not be automatically enforced unless your config is correct. The validation happens on the Composer level throughphp-tuf/composer-integration. Package manager just validates that you have it setup correctly.php-tuf/composer-integrationhas its own test suit.As soons as a 10.3.0 updates to 10.3.1 they would have the TUF protection. If we didn't a way to update their composer configuration they would not be able to do any further Package Manager/AutoUpdates operations
We already have #3394983: Automatically configure TUF Composer settings after the module is installed. This was probably also going to stable blocker regardless of whether TUF was beta requirement for core or not. This is because TUF protection is requirement for using Package Manager(and therefore AutoUpdates) not Drupal core itself. This means effectively a site that installed Package Manager in 10.3.0 when TUF was not required and then updated to 10.3.1 where TUF is required will be in the same situation as a site that installed Package Manager in 10.3.1 for the first time but the site has been around since 10.3.0 or before. The both likely will not have the configuration in their composer.json unless they did it themselves and therefore if a core requirement is that they should not have to update their composer manually then we need to be able to set this config for them whether not the first version of Package Manager/Automatic Updates requires TUF.
As far as whether this will be hard I don't think it will. Like all of the Package Manager operations it would be run in staged area first so we could do validation on their composer.json after we ran the command to ensure it was not corrupted.
Comment #35
catchSo we would need #3394983: Automatically configure TUF Composer settings after the module is installed for new sites, and then a hook_update_N() or hook_post_update_NAME() to call the same code for sites with AU installed already. Because it'd include an update handler, it wouldn't be able to be run unattended though I assume, but those can still be done semi-manually with the AU UI?
In general I think it's fine to not require TUF for AU alpha per #24 although I would like to understand @xjm's concerns more. Bringing the beta requirement into this issue is just making what could have been a much easier decision more difficult - why not have opened a new issue for this instead of completely changing the scope of this one?
Comment #36
lauriiiI believe this conversation has kept going because there hasn't been a decision on this. From my end, the conversation has mostly ended because I have been tired of having the discussion, but not because I believed there was an actual decision.
I wanted to bring the beta issue here, because I thought it was better to be transparent about our thoughts regarding the beta requirements before making a decision regarding the alpha requirements. Bringing it up later could have come up as a surprise, which could have made it look like we're trying to get rid of the requirement altogether by removing it from the requirements whenever we're deciding on requirements for the current milestone at hand.
I'm happy to see that by bringing this up, we surfaced some blockers to removing TUF from the beta requirements that seems like could be addressed. I'm fine with moving that discussion to a follow-up issue.
Comment #37
catchIn its own issue doesn't imply later.
Comment #38
lauriiiWe should probably update the issue summary since it specifically asks the following questions at the moment:
Comment #39
catch@hestenet gave an update on timelines today.
This brings up two things for me:
We definitely can't rely on a production TUF until very end of February or into March, if we want to merge automatic updates as alpha before then (which I think we do), we need to make a proper decision here on alpha requirements. It would have been nice if a production deployment happened and this entire issue became moot, but we're not there yet.
I'm wondering given the DA has TUF on a dev endpoint, would it be possible (and if so, desirable) for us to point an alpha package manager to the dev endpoint? That would completely break the hard dependency between the production deployment and an alpha commit with TUF support - we'd be able to test package manager with TUF etc.
But, it might involve work both to implement it, and to back it out again when the production endpoint is available. But assuming that all happens in alpha we could skip any upgrade path for that bit I think.
Comment #40
tedbowUsing the Dev TUF endpoint as default
Re #39
I don't think this would be possible unless we are ok for Alpha testers to experience major disruption to using Composer.
Because the TUF protection provided by the system is enforced on the Composer Plugin level that means if TUF does not validate then probably most Composer operations will not work. This means even command line Composer operations would be halted not just Composer operation through Package Manager. This is by design if TUF doesn't validate then no operations against the Composer repository can be considered safe. Even operations that don't deal with drupal.org endpoint directly may behind the scenes make calls to drupal.org endpoint. This is Composer design choice not anything to do with our plugin, we just through errors for the Composer repositories that are TUF protected.
So if the DA TUF dev endpoint is really dev status and wouldn't be up and reliable as much as the production one then it could really cause headaches. Keep in mind this is for all Composer metadata not just TUF signing.
so for instance say the DA’s dev TUF metadata expired. or since it is dev say they just had to take if offline for a couple hours to redeploy it, this would mean those sites that were pointing to that endpoint could do no Composer operations until they updated their Composer.json files manually to point to the current production Composer repository and disabled TUF on the repo.
Test with Dev TUF endpoint
Although I think enabling the TUF protection via dev endpoint would be too disruptive for tester there is a way we could test TUF protection even if it is not on by default.
We have created https://github.com/php-tuf/drupal-project(we should probably rename) which is way to setup a
drupal/recommended-projectstyle project but have Composer pointed to dev endpoint instead of https://packages.drupal.org/8. A project create with this template will be TUF protected. On the Drupal level we have aPhpTufValidatorthat simply ensures the composer plugin is present and is configured to protect https://packages.drupal.org/* repos.PhpTufValidatoris present in the current Package Manager module it just is not tagged withevent_subscriberso its logic is not enforced. In tests we add the tag.So either we could leave
PhpTufValidatoroff for this testing, though the Composer plugin would still provide TUF protection or we could make the https://packages.drupal.org/8 URL overridable and have https://github.com/php-tuf/drupal-project depend on test module that wouldPhpTufValidatorextend to protect the Dev endpoint and add theevent_subscribertag.I think this method would allow people reviewing the module to test full TUF protection against the dev endpoint in the Alpha stage but then have most testers not have to worry about the unreliability of the TUF dev endpoint(though they obviously would not get TUF protection).
Comment #41
catchIn principle this seems like a very good workaround that would allow end-to-end testing with TUF, without it actually being deployed on d.o production yet, and more flexible than #39.
Comment #42
drummRight now this is hooked up to staging.devdrupal.org, which does not have an active packing pipeline. All updates are done by somewhat-manually pulling releases down from production and setting everything off. This currently only includes the 150 most-used projects. So probably not useful to use it at al beyond development.
Comment #43
lauriiiUpdating the proposal based on the latest discussions on the issue. I'm removing the "needs product manager review", but I'm adding the "needs framework manager" review.
Comment #44
lauriiiWe need a follow-up for #40. Including that in the proposed resolution too.
Comment #45
longwaveSo the proposal in #40 is effectively using a module as a feature flag to enable TUF for testing purposes. I think this is a good idea; currently we seem to be a bit deadlocked because we only have the TUF dev endpoint and we want to test it, but to migrate confidently to the production endpoint we ideally need some testing to be completed by real world users. So if this can be enabled and disabled at will by testers, this seems like the best of both worlds.
In 10.2.0 we enabled autoconfiguration for event subscribers, so the tag is no longer necessary - so just double checking that the above statement is still true, as IIRC you are using other "new" features like autowiring in AU already: see https://www.drupal.org/node/3357408
Comment #46
catchI've tweaked the issue summary a bit to outline what's described in #40 a bit more, hopefully correctly. I'm happy to remove the RM review tag from this issue once we've got the follow-up open.
Comment #47
tedbowOk here are the 2 follow-ups
In https://github.com/php-tuf/drupal-project I added Create test module to enable TUF validation in Package Manager. This will mean if you are start a project with this project you will also get this test module you can turn on to point to the dev TUF repo.
The test module will need a change in the Package Manager contrib module to make the URL Composer repo it expects to be TUF protected changeable, so I created #3416768: For testing purposes, allow PhpTufValidator to validate repositories other than packages.drupal.org.
Note, the change to the Package Manager contrib will automatically become part of the core merge request when the conversion is run after the issue is resolved. We will make sure the test module in https://github.com/php-tuf/drupal-project will handle working with the contrib module or the core version., for Composer and other reasons the machine of the module is different,
automatic_updatesin contrib andauto_updatesin coreComment #48
tedbowUpdated the summary
Comment #49
catchI think the proposal here will allow a sufficiently realistic set-up for people to test this prior to alpha commit (whether it's the test module or because we can do it some other way), so removing the 'needs framework manager review' tag. Will leave it to another release manager to remove the RM review tag so I'm not doing double duty.
Comment #50
longwaveMy view from #45 hasn't changed, I don't see an easier way of moving this forward and starting to get test results from real users. Removing the release manager tag as @catch has also weighed in here and there have been no comments or objections from the other release managers.
I think this still needs the followup for beta discussions requested by @Lauriii in #36 and could do with an issue summary update/review before it can be marked RTBC.
Comment #51
lauriiiOpened the follow-up: #3421925: [policy, no patch] Decide if a production level TUF is a requirement for beta-level commit of Package Manager.
Comment #52
catchI think we can mark this fixed, still need to figure out what actually happens with it depending on what's easiest/ready in time but the overall proposal that we enable people to test with TUF without it necessarily being on d.o production seems like a good position compared to where everything is.
Comment #54
quietone commentedChanging to latest version when this was closed.