Skip to content

fix: do not append the system certificate bundle to itself - #41956

Merged
phil-davis merged 1 commit into
masterfrom
fix/system-certificate-bundle-self-append
Oct 30, 2026
Merged

phil-davis merged 1 commit into
masterfrom
fix/system-certificate-bundle-self-append

Conversation

@oc-tmueller

Copy link
Copy Markdown
Contributor

Description

CertificateManager::createCertificateBundle() appends the system bundle to every bundle it writes, including the system bundle itself. It opens files_external/rootcerts.crt for writing and then reads the same path back:

  • Local storage: the read returns what was just written, so ca-bundle.crt ends up in the system bundle twice.
  • Object storage: the 'w' stream is uploaded only on fclose(), so the read returns the previous bundle. The regenerated bundle is the fresh roots plus the whole old bundle. Roots that an update removed (fix: update ca-bundle.crt #41908) stay trusted, and the file grows with every regeneration.

The system bundle now skips that append. User bundles still include the system bundle.

Related

#41910 added UpdateCertificateStoreTest::testRunRegeneratesSystemBundle, which catches this on S3. It fails in owncloud/reusable-workflows' "PHP Unit with Ceph S3" jobs (for example on owncloud/reusable-workflows#106): …stale' does not contain "stale". Core's own CI runs no PHPUnit on object storage, which is why #41910 merged green.

How Has This Been Tested?

In owncloudci/php:8.3, with sqlite:

  • New testCreateSystemBundleDoesNotIncludeItself fails on master (2 is identical to 1) and passes with the fix.
  • With files_primary_s3 as primary storage on a Scality S3 server: on master, both the new test and testRunRegeneratesSystemBundle fail with the same output as the Ceph CI jobs. With the fix, CertificateManagerTest (13) and UpdateCertificateStoreTest (4) pass.

Known gap, not fixed here

A user bundle copies in the system bundle as it is on disk and does not refresh it first. If ca-bundle.crt changes without occ upgrade or maintenance:repair running, a rebuilt user bundle still carries the old system bundle's roots. #41910's repair step covers the upgrade path, because it regenerates the system bundle first. This will be handled in a separate PR.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

🤖 Generated with Claude Code

createCertificateBundle() appends the system bundle to every bundle it
writes, including the system bundle itself. On local storage that reads
back what was just written, so ca-bundle.crt ends up in it twice. On
object storage the write is uploaded only on fclose(), so the read
returns the previous bundle: removed roots stay trusted and the bundle
grows with every regeneration. UpdateCertificateStoreTest fails on S3
because of this.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Thomas Müller <323649642+oc-tmueller@users.noreply.github.com>
@oc-tmueller
oc-tmueller requested a review from a team as a code owner October 30, 2026 10:30
@phil-davis
phil-davis merged commit a67d69b into master Oct 30, 2026
36 checks passed
@phil-davis
phil-davis deleted the fix/system-certificate-bundle-self-append branch October 30, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants