Make WordPress Core

Opened 5 weeks ago

Closed 3 weeks ago

Last modified 3 weeks ago

#62812 closed enhancement (fixed)

Make it easier to update bundled certificates

Reported by: desrosj's profile desrosj Owned by: desrosj's profile desrosj
Milestone: 6.8 Priority: normal
Severity: normal Version:
Component: Security Keywords: has-patch needs-testing
Focuses: Cc:

Description (last modified by SergeyBiryukov)

The ca-bundle.crt file is a combination of the upstream Mozilla certificate bundle and some legacy 1024-bit certificates that remain for backwards compatibility (see [35919]).

#50828 was opened to update the certificate bundle for the 5.5 release, and discussion overflowed into how to make this process easier. This ticket is to continue the second part of the discussion.

Change History (11)

#1 @SergeyBiryukov
5 weeks ago

  • Description modified (diff)

Referencing comment:ticket:50828:7 and comment:ticket:50828:8 as a potential implementation here.

This ticket was mentioned in PR #8137 on WordPress/wordpress-develop by @desrosj.


5 weeks ago
#2

  • Keywords has-patch added

Adds exact copies of Mozilla certificates, splits out the legacy 1024-bit certificates included for backwards compatibility, and introduces a Grunt task that combines the two for shipping.

Trac ticket: https://core.trac.wordpress.org/ticket/62812

#3 @desrosj
5 weeks ago

I've created a PR that takes the same approach as detailed by @ayeshrajans on #50828 and adds a Grunt task for combining the files into the current file.

Still to do:

  • Confirm that the order of the certificates is not important (the legacy ones previously were included near the top).
  • Add a way to pull in updates to the files automatically.

#4 @desrosj
5 weeks ago

  • Keywords needs-testing added

Updated the PR. It now pulls the latest certificate files when running npm run grunt update-certificates.

@johnbillion commented on PR #8137:


3 weeks ago
#5

Ooh we could add https://github.com/composer/ca-bundle as a dev dependency, extract the cert bundle from that, and keep it updated via Dependabot. No need to roll our own solution.

@desrosj commented on PR #8137:


3 weeks ago
#6

Thanks @johnbillion, hadn't thought of checking Composer. Updated the PR to utilize that package as a dependency.

@johnbillion commented on PR #8137:


3 weeks ago
#7

I think composer/ca-bundle will need to be pinned to protect us against a theoretical future problem. My understanding is that the build server on dotorg doesn't use Composer, but if a change was made so that it _does_ then there's a chance that a newer version of composer/ca-bundle would get pulled in and deployed during the build.

  1. Latest version of `composer/ca-bundle is currently 1.5.6
  2. Build server runs composer install and pulls in a theoretical version 1.5.6
  3. Build server runs npm run build which calls grunt build which calls grunt build:certificates which calls grunt concat:certificates which concatenates version 1.5.6 of vendor/composer/ca-bundle/res/cacert.pem into wp-includes/certificates/cacert.pem
  4. Build server deploys WordPress with version 1.5.6 of the cert despite 1.5.5 being present in the source

Does that make sense?

@desrosj commented on PR #8137:


3 weeks ago
#8

It does. I have set up the script to only copy the cert files from vendor when running grunt update-certificates, though.

If I have done it correctly, then when build is run it should not have any impact if the version of the Composer package is changed some how. It should only use the versioned revision of the file in the src/wp-includes/certificates folder.

This was mainly to ensure someone could still run npm build without also having to run composer (install|update). But this shoudl also cover the scenario you are describing, if I understand correctly.

@johnbillion commented on PR #8137:


3 weeks ago
#9

Ah yes you are correct. copy:certificates is what copies the cert from the vendor directory, and that doesn't get run during the build. All good.

#10 @desrosj
3 weeks ago

  • Owner set to desrosj
  • Resolution set to fixed
  • Status changed from new to closed

In 59740:

Security: Introduce Grunt task for updating Root Certificates.

The Root Certificate bundle maintained by Mozilla ships in WordPress to allow SSL certificates to be verified on hosts with incomplete, outdated, or invalid local SSL configurations. To date, updates have only been merged into Core when problems arise using a highly manual process.

This introduces the certificates:upgrade Grunt task to automate the process of updating the included bundle with upstream changes using Composer to manage versioning.

The legacy 1024bit certificates included for backwards compatibility are now maintained in a separate file that is prepended to the built version of the bundle during the relevant Grunt tasks. Some expired certificates from this list have been removed:

  • Cybertrust Global Root (expired 2021-12-15)
  • Thawte Server CA (expired 2020-12-31)
  • Thawte Premium Server CA (expired 2020-12-31)

The Dependabot configuration has also been updated to open pull requests when new releases occur upstream. Going forward, the recommendation is to create a task ticket for updating these certificates with each release when an update is published. See #62811 for an example of this.

Props johnbillion, desrosj, whyisjake, ayeshrajans, SergeyBiryukov, swissspidy, skithund, barry.
Fixes #62812. See #62811, 50828.

#11 @desrosj
3 weeks ago

  • Component changed from Build/Test Tools to Security
Note: See TracTickets for help on using tickets.