Problem/Motivation
Thanks for @pwolanin raising this issue again
\Drupal\package_manager\ProjectInfo::getInstallableReleases relies solely on drupal.org Update to determine what updates are available.
These update XML files are not currently slated to TUF protected according to #3343490: Deploy rugged for TUF signing to production
Proposed resolution
We should rely on TUF protected resources to determine on what versions are secure
to options
Once #3343490: Deploy rugged for TUF signing to production is done on drupal.org then we can do #3358504: Require PHP-TUF's Composer integration plugin
After this all of our downloads of Composer metadata and targets will be TUF protected.
Then we can change the authority of what releases are available and what versions are secure to Composer instead of Update XML.
composer show drupal/core -a --format=jsonshould be able to tell us all available versionscomposer audit --format=jsonshould be able to tell us which versions are secure
Since #3350568: Drop support for Composer 2.2, require Composer >=2.5.5 we only support Composer versions that have composer audit
In either case we would have to combine this with the Update XML to provide information about security releases.
Remaining tasks
TBD. Will this allow us to drop the dependency on the Update module?
Right now we don't send emails about security updates because the Update module does that. But if we don't trust the Update XML then should we not rely on it to send the emails?
We can't really change the Update module to move from Update XML to composer commands because that would require any site that wanted this functionality have the ability to run composer commands(though not staged)
User interface changes
API changes
Data model changes
Issue fork automatic_updates-3359820
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
tedbowComment #4
tedbowgood news it looks like the new
composer auditcommand is aware of drupal security status. I made a project with Drupal core 10.0.7 which is insecureRunning
composer audit --format=jsongot meSo we could probably use this to determine if need to do updates
Comment #5
wim leersComment #6
wim leersThere's not enough detail yet in the issue summary for this to be completely actionable (which is why it is tagged ). Assigning to @tedbow for that. Note that there is no mention at all so far of finding non-security updates using this mechanism, i.e. bug fix releases.
composer auditdoes not seem to be able to give us that.I asked @omkar.podey to go ahead and start adding at least 2 methods to
ProjectInfoto help shape the direction, based on the title ("determine which update is available" [using a different mechanism]):>=10.0.0,<10.0.8implies that10.0.8is the first secure versionComment #7
omkar.podey commentedComment #8
tedbowSorry postponing this issue for now.I need to triage issues and figure what we need to work to finish #3284443: Enable unattended updates. This issue won't block that because we don't have TUF implementation done on drupal.org yet until #3343490: Deploy rugged for TUF signing to production. So could switch to using
composer auditbut that would not be TUF protectedActually what could happen now is an issue summary update:
composer auditwould require Composer > 2.4Changing to minor for now because the current actions are not urgent but once is close to be done this becomes major or critical.
Comment #9
tedbowanyone can do the 2 items in #8 and then assign it back to me
Comment #10
omkar.podey commentedComment #11
omkar.podey commentedComment #12
omkar.podey commentedupdated issue summary.
Comment #14
wim leersComment #15
wim leers@omkar.podey updated the issue summary. I added one more connection.
If this is an
alpha target, why is this marked ?Comment #17
wim leersBy the way, based on this superb comment on
composer/composerby @mxr576,composer auditas described above does actually not provide complete enough information? Definitely not for contrib (which is not yet a concern), but not even for core?! 😳 Not sure how to verify those statements though.Comment #18
wim leersInteresting prior art by @mxr756:
Comment #19
catchDoes this mean we should eventually refactor update status to rely on composer audit if/when that's available?
Comment #20
tedbow@catch eventually I think that would be good but there a couple complications.
composer auditdoesn't require rewriting the codebase so relying on Package Manager might be overkill. We could just do simpler method of calling the Composer executable and parsing the results but the site might have Composer available on the production environment.I talked with @xjm about shipping a Composer phar with core as way to be certain of the version of Composer we were using in Package Manager and she said this would not be possible(I can't remember of enough her reasoning so won't want to get it wrong here). But I assume that means we want not want to ship the phar for Update Status either
We could invoke Composer audit(probably) from the Composer php API. But that would mean we would have to add dependency on
composer/composerwhich we decided not to do in #3243899: [policy] Move composer/composer from a dev dependency to a production dependencyComment #21
tedbowWe can rely on Composer eventually for
composer auditbut right now this does not tell us if a version is unsupported.Drupal packagist could add this somehow
Comment #23
wim leersThis was discussed at DrupalCon between @tedbow, myself and the Drupal Security Team. Conclusion: this should indeed become the only mechanism we use.
The Drupal Association is working on (well, @drumm is! 😄) on bringing the necessary infrastructure live.
The issue summary needs to be updated with relevant information: sequencing and infrastructure blockers.
Comment #24
tedbowComment #25
drummComment #26
tedbowWe can't actually commit this until #3301876: Implement “list security advisories” Packagist/Composer API. It is probably not worth working to much on because it will probably be a pretty change that we would have to keep merging with 3.0.x. We should still be able to release contrib 3.0.x versions without this functionality
Comment #27
effulgentsia commentedLooks like at a minimum, this is postponed on #3301876: Implement “list security advisories” Packagist/Composer API, so adding "PP-1" to the issue title. If this is also postponed on #3343490: Deploy rugged for TUF signing to production and/or #3358504: Require PHP-TUF's Composer integration plugin, then that number should be raised accordingly, but I think there's code here than can be committed ahead of those latter two issues (but not ahead of the first one), is that right?
Comment #28
wim leersFor answering #27.
Comment #29
wim leersTo clarify the need for additional info 😊
Comment #30
tedbowWe could commit this issue before #3343490: Deploy rugged for TUF signing to production and #3358504: Require PHP-TUF's Composer integration plugin but it would not solve the stated problem of using TUF-protected sources.
It would basically switch from using Update XML to
composer auditbut the metadata in Composer not be TUF-protected so I am not sure it would helpfulComment #31
tedbowI think we can work on this again.
there are number of drupal.org infrastructure issues that need to be resolved for it to be committed but we should still be able to work on tests because we will always rely on mocked composer output for tests
Comment #32
tedbowComment #34
tedbowI talked with @phenaproxima and @effulgentsia yesterday and proposed the idea of instead of altering any of the services by the update module we simply confirm the information available the drupal.org update.xml matches the same releases and secure status from Composer.
This has 2 advantages,
either in
\Drupal\package_manager\ProjectInfo::getInstallableReleasesFor now we could hard-code what versions of core are supported via the info in
\Drupal\update\ProjectSecurityDatacombined with the releases that available of core according to composerComment #35
tedbowI talked to @phenaproxima about this recently
We had talked about making sure that information from update XML matched what available in the ProjectInfo class basically
The problem I realize now is that we really can't do that in
\Drupal\package_manager\ProjectInfo::getInstallableReleases()for few reasons:composer infoandcomposer auditat the time we processing the releases. So if there is new release in the last hourcomposer infowould return it and the cached update XML might not have it yet. So if we throw an exception because they don't match that will be problem\Drupal\package_manager\ProjectInfo::getProjectInfowhich is called at the beginning ofgetInstallableReleases()is going to callupdate_calculate_project_data()which depending on which releases are marked as supported or unpublished could mark the project itself as unpublished. So we have to do the check against composer before this pointgetProjectInfo()andgetInstallableReleases()both callgetAvailableProjects()so we could check composer info there but we have the problem that for projects that are in the active codebase we rely onupdate_get_available()but if we do that then we run into the timing problem again. That data could be hours old and a current call tocomposer infomight not matchFor that reason it is probably best to compare against Composer info in
\Drupal\package_manager\PackageManagerUpdateProcessor::processFetchTask()we should probably not rely on the Update modle process at all since this data would not be compared against composer. So this would probably mean doing #3308235: Do not use the Update modules cache of UPdate XML so we can control how long it is cached but that should be a small change.Comment #36
drummThe data source for advisories and insecure releases for packages.drupal.org is different from the one used for updates.drupal.org. So there will be mismatches from time to time. This may be due to human error, as both are maintained somewhat manually as advisories are published & updated.
#3383066: Use SA Affected Version to determine whether old versions are insecure could unify these, although I was hoping to wait until 7.x support was dropped, as this could only happen for modern Drupal releases.
Notably, there are a handful of unstable releases, beta & RCs, marked as insecure for update status XML as they address security issues. But there was no advisory, so packages.drupal.org does not have that data. We could remove the insecure flag from those releases, as it was never the security team’s policy.
Comment #37
tedbowPostponing this on #3394754: [policy, no patch] Use Update XML in Package manager to determine release support status and updated #3319030: Drupal Core Roadmap for Package Manager and Update Manager to reflect this. I just want it to very clear that the core issue blocking work on one of our last Alpha core blockers
Comment #38
catchWith a narrower scope, I think this would now be postponed on #3394754: [policy, no patch] Use Update XML in Package manager to determine release support status implementing the functionality with update XML, and then a decision whether we move all that metadata to Drupal's packagist endpoint.
Comment #39
catchTagging for issue summary update since it would be good to document what it would entail to rely 100% on composer/d.o packagist for this information.